public IHttpActionResult PostService(ServiceViewModel service) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } serviceRepository.UpdateService(service.MapTo <Service>()); return(Ok(service)); }
public IHttpActionResult PutService(int id, ServiceViewModel service) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != service.Id) { return(BadRequest()); } serviceRepository.UpdateService(service.MapTo <Service>()); return(StatusCode(HttpStatusCode.NoContent)); }