// // GET: /Platform/SysAction/Edit/5 /// <summary> /// 编辑 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Edit(string id) { var item = new SysAction(); if (!string.IsNullOrEmpty(id)) { item = _sysActionService.GetById(id); } return(View(item)); }
// // GET: /Platform/SysAction/Edit/5 public ActionResult Edit(Guid?id) { var item = new SysAction(); if (id.HasValue) { item = _sysActionService.GetById(id.Value); } return(View(item)); }
public ActionResult Edit(Guid?id, SysAction collection) { if (!ModelState.IsValid) { return(View(collection)); } _sysActionService.Save(id, collection); _unitOfWork.Commit(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit(string id, SysAction collection) { if (!ModelState.IsValid) { Edit(id); return(View(collection)); } _sysActionService.Save(id, collection); await _unitOfWork.CommitAsync(); return(new EditSuccessResult(id)); }
public int Edit(Models.MenuModel menu) { SysAction sysaction = new SysAction(); sysaction = db.SysActions.Find(menu.ActionCode); if (sysaction != null) { menu.Action = sysaction.Action; menu.Area = sysaction.Area; menu.Controller = sysaction.Controller; menu.Icon = sysaction.Icon; } db.Entry(menu.toSysMenu()).State = EntityState.Modified; return db.SaveChanges(); }
public int AddMenu(Models.MenuModel menu) { SysAction sysaction = new SysAction(); sysaction = db.SysActions.Find(menu.ActionCode); if (sysaction != null) { menu.Action = sysaction.Action; menu.Area = sysaction.Area; menu.Controller = sysaction.Controller; menu.Icon = sysaction.Icon; } db.SysMenus.Add(menu.toSysMenu()); return db.SaveChanges(); }
public ActionResult Create(ActionViewModel viewModel) { try { if (ModelState.IsValid == false) { return(WriteError("实体验证失败")); } SysAction sysAction = new SysAction { Name = viewModel.Name, ParentId = viewModel.ParentId, Code = viewModel.Code, Type = viewModel.Type, SortCode = viewModel.SortCode, CreateTime = DateTime.Now, UpdateTime = DateTime.Now, CreateUserId = UserManager.GetCurrentUserInfo().Id, UpdateUserId = UserManager.GetCurrentUserInfo().Id }; if (viewModel.Type == ActionTypeEnum.Menu) { sysAction.SysActionMenu = new SysActionMenu { Icon = viewModel.Icon, Url = viewModel.Url }; } else if (viewModel.Type == ActionTypeEnum.Button) { sysAction.SysActionButton = new SysActionButton { ButtonCode = viewModel.ButtonCode, Location = viewModel.Location, ButtonClass = viewModel.ButtonClass, ButtonIcon = viewModel.ButtonIcon }; } else { return(WriteError("类型不正确")); } SysActionService.Add(sysAction); return(WriteSuccess()); } catch (Exception ex) { return(WriteError(ex)); } }
public ActionResult Action(SysAction model) { if (model.Name.IsNullOrEmpty()) { return(JsonError("名称不能为空")); } if (model.ActionCode.IsNullOrEmpty()) { return(JsonError("ActionCode不能为空")); } if (model.Id > 0) { var action = _sysActionService.Get(m => m.Id == model.Id); if (action != null && action.Id > 0) { action.Name = model.Name; action.ActionCode = model.ActionCode; action.ActionIcon = model.ActionIcon; action.ActionTitle = model.ActionTitle; if (_sysActionService.Update(action) > 0) { return(JsonSuccess(action.Id.ToString())); } } } else { var action = new SysAction { Name = model.Name, ActionCode = model.ActionCode, ActionIcon = model.ActionIcon, ActionTitle = model.ActionTitle }; if (_sysActionService.Insert(action) > 0) { return(JsonSuccess(action.Id.ToString())); } } return(JsonError("操作失败,请稍后重试")); }
// // GET: /Platform/SysAction/Details/5 public ActionResult Details(Guid id) { SysAction item = _sysActionService.GetById(id); return(View(item)); }
public static SysActionViewModel EntityMap(this SysAction model) { return(Mapper.Map <SysAction, SysActionViewModel>(model)); }
public void SetAction(SysAction Act) { this.Name = "System Action"; this.DoAction = Act; }