public HttpResponseMessage Add([FromBody] Gepro.SaaS.Domain.Entities.Person.PersonType entity) { try { service.Add(entity); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created); response.Headers.Location = new Uri(Url.Link("DefaultApi", new { controller = "PersonType", id = entity.Id })); return(response); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
public HttpResponseMessage Edit([FromBody] Gepro.SaaS.Domain.Entities.Person.PersonType entity) { try { var item = service.ListById(entity.Id); if (item == null) { throw new KeyNotFoundException(); } service.Update(entity); return(Request.CreateResponse(HttpStatusCode.OK)); } catch (KeyNotFoundException) { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Not found")); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
public void Update(Gepro.SaaS.Domain.Entities.Person.PersonType entity) { repository.Edit(entity); }
public void Add(Gepro.SaaS.Domain.Entities.Person.PersonType entity) { repository.Add(entity); }