public void Update(HousingTypeDTO housingTypeDTO) { HousingType housingType = Mapper.Map <HousingType>(housingTypeDTO); _unitOfWork.HousingTypes.Update(housingType); _unitOfWork.Save(); }
public ActionResult Create([Bind(Include = "Name")] HousingTypeVM housingTypeVM) { if (ModelState.IsValid) { HousingTypeDTO housingTypeDTO = Mapper.Map <HousingTypeDTO>(housingTypeVM); HousingTypeService.Add(housingTypeDTO); return(RedirectToAction("Index")); } return(View()); }
public ActionResult Edit(int?id) { try { HousingTypeDTO housingTypeDTO = HousingTypeService.Get(id); HousingTypeVM housingTypeVM = Mapper.Map <HousingTypeVM>(housingTypeDTO); return(View(housingTypeVM)); } catch (ArgumentNullException) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } catch (NotFoundException) { return(HttpNotFound()); } }