Example #1
0
 public ActionResult Edit(RoleModel model)
 {
     var role = this._roleService.Get(model.Id);
     role = model.ToEntity(role);
     this._roleService.Update(role);
    var d= this._userProfileService.List().Where(m => m.RoleId == role.Id).ToList().Select(m =>
    {
        var t=m;
        t.RoleId = 2;
        return t;
    });
     this._userProfileService.Update(d.ToList());
     var s = this._roleAppService.GetRoleAppByRoleId(role.Id).ToList();
     this._roleAppService.Delete(s);
     SaveRoleApps(role, StringToArray(model.RoleAppTag));           
     ReSetFancyApp(model, d);
     SaveUsers(role, StringToArray(model.UserTag)); 
     _result = "success";
     return Content(_result);
 }
Example #2
0
 public ActionResult Create(RoleModel model)
 {
     if (_roleService.List().Count(m => m.Title == model.Title) > 0)
     {
         _result = "failed";
         return Content(_result);
     }
     var role = model.ToEntity();
     model.AddTime = DateTime.Now;
     _roleService.Add(role);
     SaveRoleApps(role, StringToArray(model.RoleAppTag));
     SaveUsers(role, StringToArray(model.UserTag));
     SaveUserFancies(StringToArray(model.RoleAppTag), StringToArray(model.UserTag));
     _result = "success";
     return Content(_result);
 }