public void Delete(ContractTypeViewModel model) { var item = _repository.FindById(model.Id); if (item != null) { _repository.Delete(item); } }
public ActionResult Delete(ContractTypeViewModel model) { try { _contractTypeService.Delete(model); _contractTypeService.Save(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(ContractTypeViewModel model) { try { if (ModelState.IsValid) { _contractTypeService.Insert(model); _contractTypeService.Save(); return(RedirectToAction("Index")); } return(View(model)); } catch { return(View()); } }
public ActionResult Edit(ContractTypeViewModel model) { try { var contractType = _contractTypeService.GetInfo(model.Id); if (contractType == null || contractType.Id <= 0) { return(HttpNotFound()); } _contractTypeService.Update(model); _contractTypeService.Save(); return(RedirectToAction("Index")); } catch { return(View()); } }
public void Update(ContractTypeViewModel model) { var contractType = AutoMapper.Mapper.Map <ContractTypeViewModel, ContractType>(model); _repository.Update(contractType); }
public void Insert(ContractTypeViewModel model) { var contractType = AutoMapper.Mapper.Map <ContractTypeViewModel, ContractType>(model); _repository.Add(contractType); }