コード例 #1
0
        public ActionResult Edit(ViewModelModel model)
        {
            var entity = Mapper.Map<ViewModelModel, Model>(model);
            ResponseMessage response =  _modelService.Update(entity);

            if (response.IsError == true)
            {
                foreach (var item in response.ErrorCodes)
                {
                    ModelState.AddModelError(item, item);
                }

                return View(model);
            }
            return RedirectToAction("Index");
        }
コード例 #2
0
 public ActionResult Create(ViewModelModel model)
 {
     var entity = Mapper.Map<ViewModelModel, Model>(model);
     _modelService.Add(entity);
     return RedirectToAction("Index");
 }