public SystemEducationDTO newSystemEducation(SystemEducationDTO SystemEducation) { var adedSystemEducation = MapperFactory.CurrentMapper.Map <SystemEducation>(SystemEducation); adedSystemEducation = uow.GetRepository <SystemEducation>().Add(adedSystemEducation); uow.SaveChanges(); return(MapperFactory.CurrentMapper.Map <SystemEducationDTO>(adedSystemEducation)); }
public SystemEducationDTO updateSystemEducation(SystemEducationDTO SystemEducation) { var selectedSystemEducation = uow.GetRepository <SystemEducation>().Get(z => z.Id == SystemEducation.Id); selectedSystemEducation = MapperFactory.CurrentMapper.Map(SystemEducation, selectedSystemEducation); uow.GetRepository <SystemEducation>().Update(selectedSystemEducation); uow.SaveChanges(); return(MapperFactory.CurrentMapper.Map <SystemEducationDTO>(selectedSystemEducation)); }
public HttpResponseMessage Get(int Id) { SystemEducationDTO selectedTitle = service.getSystemEducation(Id); if (selectedTitle == null) { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, Id + sysLanguage.CompanyTitlesControllerStrings.id_title)); } return(Request.CreateResponse(HttpStatusCode.OK, selectedTitle)); }
public HttpResponseMessage Put(SystemEducationDTO SystemEducationDTO) { SystemEducationDTO dto = service.updateSystemEducation(SystemEducationDTO); if (dto != null) { return(Request.CreateResponse(HttpStatusCode.OK, dto)); } else { return(Request.CreateErrorResponse(HttpStatusCode.SeeOther, sysLanguage.CompanyTitlesControllerStrings.update_title)); } }
public SystemEducationDTO newSystemEducation(SystemEducationDTO systemEducation) { if (!uow.GetRepository <SystemEducation>().GetAll().Any(z => z.Id == systemEducation.Id)) { var adedSystemEducation = MapperFactory.CurrentMapper.Map <SystemEducation>(systemEducation); adedSystemEducation = uow.GetRepository <SystemEducation>().Add(adedSystemEducation); uow.SaveChanges(); return(MapperFactory.CurrentMapper.Map <SystemEducationDTO>(adedSystemEducation)); } else { return(null); } }
public HttpResponseMessage Post(SystemEducationDTO SystemEducationDTO) { SystemEducationDTO dto = service.newSystemEducation(SystemEducationDTO); if (dto != null) { HttpResponseMessage message = Request.CreateResponse(HttpStatusCode.Created, dto); message.Headers.Location = new Uri(Request.RequestUri + "/" + dto.Id); return(message); } else { return(Request.CreateErrorResponse(HttpStatusCode.SeeOther, sysLanguage.CompanyTitlesControllerStrings.add_title)); } }