示例#1
0
        public async Task<ActionResult> EditValue(PropValueViewModel valueView)
        {
            if (ModelState.IsValid)
            {
                var value = valueRep.FindById(valueView.VId);
                if (value == null)
                {
                    return HttpNotFound();
                }

                value.ValueName = valueView.ValueName;
                value.SortOrder = valueView.SortOrder;
                valueRep.Update(value);
                await uow.SaveAsync();
                return RedirectToAction("ValueList", new { pid = valueView.PId });
            }
            ModelState.AddModelError("", "操作失败。");
            return View(valueView);
        }
示例#2
0
        public async Task<ActionResult> CreateValue(PropValueViewModel valueView)
        {
            if (ModelState.IsValid)
            {
                var value = valueRep.Create(new PropValue
                {
                    PId = valueView.PId,
                    ValueName = valueView.ValueName,
                    SortOrder = valueView.SortOrder,
                    Status = 1
                });

                await uow.SaveAsync();
                return RedirectToAction("ValueList", new { pid = valueView.PId });
            }
            ModelState.AddModelError("", "操作失败。");

            return View(valueView);
        }