public JsonResult AssignVM(ExecuteVM executeVm, int id)
 {
     var check = _vmUserService.CheckUser(id, executeVm.RoleName);
     if (!check)
     {
         var assignVm = new VMUser();
         assignVm.UserId = id;
         assignVm.ServiceName = executeVm.ServiceName;
         assignVm.DeploymentName = executeVm.DeploymentName;
         assignVm.VMName = executeVm.RoleName;
         _vmUserService.AssignUserToVM(assignVm);
         return Json("Success");
     }
     else
     {
         return Json("This user already has " + executeVm.RoleName);
     }
 }
Exemple #2
0
 public void AssignUserToVM(VMUser vmUser)
 {
     DataContext.VMUsers.Add(vmUser);
     DataContext.SaveChanges();
 }