I want to update my entity for just sending values.
public HttpResponseMessage UpdateDepartment(Department department)
{
var ok = _departmentDAL.Update(department);
return Request.CreateResponse(HttpStatusCode.OK, ok);
}
Im sending just 2 value with postman to my api.
In my generic repository base, my update function like.
public int Update(TEntity entity)
{
var updatedEntity = _context.Entry(entity);
updatedEntity.State = EntityState.Modified;
return _context.SaveChanges();
}
And I got entity validation error. Simply I just want to modify only not null values of entity.
Is it possible or should I take all entity with my Id property from database and then after changing the properties send to the entity framework ?