Exemplo n.º 1
0
 public ActionResult AddRoleToMenu(RoleAccess roleAccess)
 {
     if (ModelState.IsValid)
     {
         try
         {
             //Delete Menu Access
             RoleManagementTables.DeleteRolesMenu(roleAccess.roleID);
             //Insert Data
             foreach (AccessType accessType in roleAccess.dataaccess)
             {
                 RoleManagementTables.InsertNewRoleAccess(new RoleMenuAccess {
                     RoleID = roleAccess.roleID, MenuHdrID = accessType.moduleID
                 });
             }
             return(Json(new { isError = "F", message = "New role has been added!" }));
         }
         catch (Exception ex)
         {
             return(Json(new { isError = "T", message = "Could not insert data." }));
         }
     }
     else
     {
         return(Json(new { isError = "T", message = "Could not insert data." }));
     }
 }