public ActionResult Create(FormCollection formCollection, TagViewModel vo) { if (ModelState.IsValid) { var entity = MappingManager.TagEntityMapping(vo); entity.CreatedUser = base.CurrentUser.CustomerId; entity.UpdatedUser = base.CurrentUser.CustomerId; entity.Status = (int)DataStatus.Normal; entity = this._tagRepository.Insert(entity); return RedirectToAction("Details", new { id = entity.Id }); } return View(vo); }
public ActionResult Edit(FormCollection formCollection, [FetchTag(KeyName = "id")]TagEntity entity, TagViewModel vo) { if (entity == null || !ModelState.IsValid) { ModelState.AddModelError("", "参数验证失败."); return View(vo); } entity.Description = vo.Description??string.Empty; entity.Name = vo.Name; entity.SortOrder = vo.SortOrder; entity.UpdatedDate = DateTime.Now; entity.UpdatedUser = CurrentUser.CustomerId; this._tagRepository.Update(entity); return RedirectToAction("Details", new { id = entity.Id }); }