示例#1
0
        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));
        }
示例#2
0
        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));
        }
示例#3
0
        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));
        }