public EducationsTypeDTO updateEducationsType(EducationsTypeDTO educationsType) { var selectedEducationsType = uow.GetRepository <EducationsType>().Get(z => z.Id == educationsType.Id); selectedEducationsType = MapperFactory.CurrentMapper.Map(educationsType, selectedEducationsType); uow.GetRepository <EducationsType>().Update(selectedEducationsType); uow.SaveChanges(); return(MapperFactory.CurrentMapper.Map <EducationsTypeDTO>(selectedEducationsType)); }
public HttpResponseMessage Get(int Id) { EducationsTypeDTO selectedTitle = service.getEducationsType(Id); if (selectedTitle == null) { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, Id + sysLanguage.CompanyTitlesControllerStrings.id_title)); } return(Request.CreateResponse(HttpStatusCode.OK, selectedTitle)); }
public HttpResponseMessage Put(EducationsTypeDTO EducationsTypeDTO) { EducationsTypeDTO dto = service.updateEducationsType(EducationsTypeDTO); if (dto != null) { return(Request.CreateResponse(HttpStatusCode.OK, dto)); } else { return(Request.CreateErrorResponse(HttpStatusCode.SeeOther, sysLanguage.CompanyTitlesControllerStrings.update_title)); } }
public EducationsTypeDTO newEducationsType(EducationsTypeDTO educationsType) { if (!uow.GetRepository <EducationsType>().GetAll().Any(z => z.Id == educationsType.Id)) { var adedEducationsType = MapperFactory.CurrentMapper.Map <EducationsType>(educationsType); adedEducationsType = uow.GetRepository <EducationsType>().Add(adedEducationsType); uow.SaveChanges(); return(MapperFactory.CurrentMapper.Map <EducationsTypeDTO>(adedEducationsType)); } else { return(null); } }
public HttpResponseMessage Post(EducationsTypeDTO EducationsTypeDTO) { EducationsTypeDTO dto = service.newEducationsType(EducationsTypeDTO); 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)); } }