public EducationStatusDTO updateEducationStatus(EducationStatusDTO EducationStatus)
        {
            var selectedEducationStatus = uow.GetRepository <EducationStatus>().Get(z => z.Id == EducationStatus.Id);

            selectedEducationStatus = MapperFactory.CurrentMapper.Map(EducationStatus, selectedEducationStatus);
            uow.GetRepository <EducationStatus>().Update(selectedEducationStatus);
            uow.SaveChanges();
            return(MapperFactory.CurrentMapper.Map <EducationStatusDTO>(selectedEducationStatus));
        }
Пример #2
0
        public HttpResponseMessage Get(int Id)
        {
            EducationStatusDTO selectedTitle = service.getEducationStatus(Id);

            if (selectedTitle == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, Id + sysLanguage.CompanyTitlesControllerStrings.id_title));
            }
            return(Request.CreateResponse(HttpStatusCode.OK, selectedTitle));
        }
Пример #3
0
        public HttpResponseMessage Put(EducationStatusDTO accessTypeDTO)
        {
            EducationStatusDTO dto = service.updateEducationStatus(accessTypeDTO);

            if (dto != null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, dto));
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.SeeOther, sysLanguage.CompanyTitlesControllerStrings.update_title));
            }
        }
 public EducationStatusDTO newEducationStatus(EducationStatusDTO EducationStatus)
 {
     if (!uow.GetRepository <EducationStatus>().GetAll().Any(z => z.Id == EducationStatus.Id))
     {
         var adedEducationStatus = MapperFactory.CurrentMapper.Map <EducationStatus>(EducationStatus);
         adedEducationStatus = uow.GetRepository <EducationStatus>().Add(adedEducationStatus);
         uow.SaveChanges();
         return(MapperFactory.CurrentMapper.Map <EducationStatusDTO>(adedEducationStatus));
     }
     else
     {
         return(null);
     }
 }
Пример #5
0
        public HttpResponseMessage Post(EducationStatusDTO accessTypeDTO)
        {
            EducationStatusDTO dto = service.newEducationStatus(accessTypeDTO);

            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));
            }
        }