public OfficeTypeDTO InsertOfficeType(OfficeTypeDTO data) { OfficeType dataToInsert = new OfficeType(); dataToInsert = OfficeTypeRequestFormatter.ConvertRespondentInfoFromDTO(data); return(OfficeTypeRequestFormatter.ConvertRespondentInfoToDTO(_unitOfWork.OfficeTypeRepository.Create(dataToInsert))); }
public int UpdateOfficeType(OfficeTypeDTO data) { OfficeType dataToUpdate = new OfficeType(); dataToUpdate = OfficeTypeRequestFormatter.ConvertRespondentInfoFromDTO(data); var response = _unitOfWork.OfficeTypeRepository.Update(dataToUpdate); return(response); }
public ActionResult OfficeCreateClose(OfficeTypeDTO data) { try { if (!ModelState.IsValid) { return(RedirectToAction("OfficeTypes")); } OfficeTypeDTO res = new OfficeTypeDTO(); res = _officeTypeService.InsertOfficeType(data); ViewBag.Success = "New Office Type created successfully"; return(RedirectToAction("OfficeTypes")); } catch (Exception ex) { ViewBag.Error = ex.Message; return(RedirectToAction("OfficeTypes")); } }
public static OfficeType ConvertRespondentInfoFromDTO(OfficeTypeDTO officeTypeDTO) { Mapper.CreateMap <OfficeTypeDTO, OfficeType>(); return(Mapper.Map <OfficeTypeDTO, OfficeType>(officeTypeDTO)); }
public ActionResult OfficeTypeEdit(OfficeTypeDTO data) { int res = _officeTypeService.UpdateOfficeType(data); return(RedirectToAction("OfficeTypeEdit", data.OfficeTypeId)); }
public ActionResult OfficeTypeEdit(int id) { OfficeTypeDTO res = _officeTypeService.GetOfficeTypeById(id); return(View(res)); }