public ActionResult Create(RequirementTemplateViewModel vm) { try { if (ModelState.IsValid) { RequirementTemplateEntity entity = Mapper.Map <RequirementTemplateViewModel, RequirementTemplateEntity>(vm); setIdUser(ref entity); setCreationDate(ref entity); Service.add(ref entity); success("Register was made with Success!"); return(RedirectToAction("Index")); } return(View()); } catch (Exception ex) { throw ex; } }
public ActionResult Edit(RequirementTemplateViewModel vm) { try { RequirementTemplateEntity entity = new RequirementTemplateEntity(); if (ModelState.IsValid) { entity = Mapper.Map <RequirementTemplateViewModel, RequirementTemplateEntity>(vm); Service.update(ref entity); success("Register has been successfully edited!"); return(RedirectToAction("Index")); } return(View(entity)); } catch (Exception ex) { throw ex; } }
public ActionResult Delete(int?id) { try { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RequirementTemplateEntity entity = Service.get(id); RequirementTemplateViewModel vm = Mapper.Map <RequirementTemplateEntity, RequirementTemplateViewModel>(entity); if (vm == null) { return(HttpNotFound()); } return(View(vm)); } catch (Exception ex) { throw ex; } }