TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ramco Ramco
442
3.4k
528.7k
Post Api Error - Value cannot be null
Feb 26 2021 8:58 AM
Hi
I am getting this error -
{ "Message": "An error has occurred.", "ExceptionMessage": "Value cannot be null.\r\nParameter name: entity", "ExceptionType": "System.ArgumentNullException", "StackTrace": " at System.Data.Entity.Utilities.Check.NotNull[T](T value, String parameterName)\r\n at System.Data.Entity.DbSet`1.Add(TEntity entity)\r\n at ProjectManagement.Controllers.EmployeesController.PostEmployee(Employee employee) in C:\\Users\\jagji\\documents\\visual studio 2015\\Projects\\ProjectManagement\\ProjectManagement\\Controllers\\EmployeesController.cs:line 142" }
Below values i entered in PostMan -
[ { "Id": 10, "Name": "Mark 10", "DepartmentId": 1, "Email": "
[email protected]
", "Active": "Y", "Gender":"Male" }]
public
partial
class
Employee {
public
int
ID {
get
;
set
;
}
public
string
Name {
get
;
set
;
}
public
string
Email {
get
;
set
;
}
public
string
Gender {
get
;
set
;
}
public
Nullable <
int
> Salary {
get
;
set
;
}
public
Nullable <
int
> DepartmentId {
get
;
set
;
}
public
string
Active {
get
;
set
;
}
public
Nullable < System.DateTime > CreatedOn {
get
;
set
;
}
public
Nullable < System.DateTime > UpdatedOn {
get
;
set
;
}
//public Department Department { get; set; } public virtual Department Department { get; set; } }
Thanks
Reply
Answers (
2
)
API with JWT Auth - .Net 5.0
Basic Authentication Using Message Handler in Web API