Exemplo n.º 1
0
 public ViewResult EditAdmin(int id)
 {
     var user = DataLoader.LoadUser(i => i.id == id && i.role_id != BusinessBase.UserRoleId);           
     var model = new EditUserViewModel() { Value = user };
     model.ErrorMessage = user == null ? "This user doesn't exist or you don't have enough right to edit this profile." : "";
     return View(model);
 }
Exemplo n.º 2
0
 private async Task<EditUserViewModel> GetUserForView(int id, bool isSuperAdmin, string errorMessage = "default", string modelTile = "User Details")
 {
     var user = isSuperAdmin ? DataLoader.LoadUser(i => i.id == id && i.role_id != BusinessBase.UserRoleId) :
                DataLoader.LoadUser(i => i.id == id && i.role_id == BusinessBase.UserRoleId);
     var model = new EditUserViewModel(modelTile);
     model.Value = user;
     if (user != null)
     {
         var addtionalInfo = await DataLoader.Context.GetUserAdditionalInformation(id);
         ModelObjectHelper.CopyObject(addtionalInfo, model);
     }
     else
     {
         model.ErrorMessage = errorMessage == "default" ? "Sorry this user doesn't exist or you don't have enough authority to view this user's profile." : errorMessage;
     }
     return model;
 }