예제 #1
0
 public ActionResult ProjectPermission(List <int> From, List <int> To)
 {
     try
     {
         DSRCManagementSystemEntities1 db = new DSRCManagementSystemEntities1();
         var deleteuser = db.ViewallProjectPermissions.Where(x => x.IsAuthorized == true).Select(o => o).ToList();
         foreach (var deluser in deleteuser)
         {
             db.ViewallProjectPermissions.DeleteObject(deluser);
         }
         db.SaveChanges();
         for (int j = 0; j < To.Count(); j++)
         {
             DSRCManagementSystem.ViewallProjectPermission objaccess = new DSRCManagementSystem.ViewallProjectPermission();
             objaccess.UserId       = To[j];
             objaccess.IsAuthorized = true;
             db.AddToViewallProjectPermissions(objaccess);
             db.SaveChanges();
         }
         return(Json("Authorize", JsonRequestBehavior.AllowGet));
     }
     catch (Exception Ex)
     {
         string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
         string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
         ExceptionHandlingController.ExceptionDetails(Ex, actionName, controllerName);
         return(Json("Failed", JsonRequestBehavior.AllowGet));
     }
 }