public ActionResult Add(decimal StandardId) { ViewBag.Title = Resources.PageTitle.Evidence_Add; ViewBag.PageBar = GetPageBar(Resources.PageTitle.Evidence_Add); var model = new EvidenceViewModel(); model.StandardId = StandardId; return(View(model)); }
public JsonResult Edit(EvidenceViewModel model) { if (ModelState.IsValid) { var EvidenceEntity = _evidenceService.GetById(model.Id); EvidenceEntity = Mapper.Map(model, EvidenceEntity); _evidenceService.Edit(EvidenceEntity); return(Json(new { data = model, success = true }, JsonRequestBehavior.AllowGet)); } var errors = ModelState.GetDistinctModelErrors(); return(Json(new { data = model, success = false, ErrorsList = errors }, JsonRequestBehavior.AllowGet)); }
public JsonResult Add(EvidenceViewModel model) { if (ModelState.IsValid) { var EntityMapped = Mapper.Map <Evidence>(model); EntityMapped.CreatedById = CurrentUser.Id; EntityMapped.CreatedDate = DateTime.Now; _evidenceService.Add(EntityMapped); return(Json(new { data = model, success = true }, JsonRequestBehavior.AllowGet)); } var errors = ModelState.GetDistinctModelErrors(); return(Json(new { data = model, success = false, ErrorsList = errors }, JsonRequestBehavior.AllowGet)); }