public ActionResult Add() { var vm = new RoleVModel() { IsSuper = false }; return(View(vm)); }
public IActionResult Update([FromBody] RoleVModel model) { var result = new ResultModel(); return(this.Wrapper(ref result, () => { result = _roleRepository.Update(new HeyTom.Manage.Model.Role() { Id = model.id, Name = model.name, Type = 0, Remark = model.remark }); }, true)); }
public JsonResult Add(RoleVModel model) { var result = new JsonResultModel(); if (ModelState.IsValid) { //add result.ResultState = Roles.AddRole(Roles.RoleVModelToInfo(model)) > 0; } else { result.ResultState = false; result.Message = ModelStateHelper.GetAllErrorMessage(ModelState); } return(Json(result)); }
/// <summary> /// ViewModel 转 DataModel /// </summary> /// <param name="role"></param> /// <returns></returns> public static RoleInfo RoleVModelToInfo(RoleVModel role) { if (role == null) { return(new RoleInfo()); } return(new RoleInfo { Id = role.Id, RName = role.RName, CreateTime = role.CreateTime, IsDel = role.IsDel, Description = role.Description, IsSuper = role.IsSuper, ArticleNeedVerified = role.ArticleNeedVerified, CommentNeedVerified = role.CommentNeedVerified }); }
public ActionResult Add() { var vm = new RoleVModel(); return(View(vm)); }