public ActionResult Post([FromBody] LitePersonWidgetDTO value) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (value == null) { return(BadRequest()); } repoWrapper.PersonWidget.Insert(mapper.Map <PersonWidget>(value)); repoWrapper.Save(); return(Ok()); }
public ActionResult Put(long id, [FromBody] LitePersonWidgetDTO value) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != value.Id) { return(BadRequest("Value with the given id doesn't exist.")); } var entity = repoWrapper.PersonWidget.Get(id); if (entity == null) { return(BadRequest("Value with the given id is null")); } mapper.Map(value, entity); repoWrapper.Save(); return(Ok()); }