public Consortium CreateConsortium(ConsortiumRequest consortium) { Consortium originalConsortium = new Consortium(); var entityToInsert = MergeConsortium(originalConsortium, consortium); ConsortiumRepository.Insert(entityToInsert); return(entityToInsert); }
// PUT api/<controller>/5 /// <summary> /// Modifica un consorcio /// </summary> /// <param name="consortium">Consorcio a modificar</param> /// <returns></returns> public IHttpActionResult Put(int id, ConsortiumRequest consortium) { var originalConsortium = ConsortiumService.GetById(id); var ret = ConsortiumService.UpdateConsortium(originalConsortium, consortium); return(Ok()); }
public IHttpActionResult Post(ConsortiumRequest consortium) { var result = ConsortiumService.CreateConsortium(consortium); return(Created <Entidad>("", new Entidad { Id = result.Id })); }
private Consortium MergeConsortium(Consortium originalConsortium, ConsortiumRequest consortium) { originalConsortium.CUIT = consortium.CUIT; originalConsortium.FriendlyName = consortium.FriendlyName; originalConsortium.MailingList = consortium.MailingList; originalConsortium.Telephone = consortium.Telephone; originalConsortium.Administration = this.AdministrationRepository.GetById(consortium.AdministrationId); originalConsortium.Ownership = this.OwnershipRepository.GetById(consortium.OwnershipId); return(originalConsortium); }
public Consortium UpdateConsortium(Consortium originalConsortium, ConsortiumRequest consortium) { originalConsortium = this.MergeConsortium(originalConsortium, consortium); ConsortiumRepository.Update(originalConsortium); return(originalConsortium); }
public bool UpdateConsortium(ConsortiumRequest consortium) { return(IntegrationService.RestCallNoReturn(ConfigurationManager.AppSettings["ApiCoreUrl"], string.Format(ApiCore.UpdateConsortium, consortium.Id), RestMethod.Put, null, consortium)); }
public bool CreateConsortium(ConsortiumRequest consortium) { return(IntegrationService.RestCallNoReturn(ConfigurationManager.AppSettings["ApiCoreUrl"], ApiCore.CreateConsortium, RestMethod.Post, null, consortium)); }