Пример #1
0
        public UserViewErrorModel GetUserViewModel(string userName)
        {
            var returnModel = new UserViewErrorModel();

            try
            {
                var user = _UOF.Users.Get(userName);
                if (user == null)
                {
                    returnModel.ErrorMessage = "Can not find user";
                    returnModel.Error        = true;
                    return(returnModel);
                }
                var userView = _ViewModelEngine.GetUserViewModel(user);
                if (userView == null)
                {
                    returnModel.ErrorMessage = "Can not create user view";
                    returnModel.Error        = true;
                    return(returnModel);
                }
                returnModel.Error = false;
                returnModel.Item  = userView;
                return(returnModel);
            }
            catch (Exception exception)
            {
                returnModel.Error        = true;
                returnModel.ErrorMessage = "Thomething goes wrong!";
                return(returnModel);
            }
        }
Пример #2
0
 public UserView GetUserViewModel(string UserName)
 {
     try
     {
         var user = _UOF.Users.Get(UserName);
         return(_viewModelEngine.GetUserViewModel(user));
     }
     catch (Exception exception)
     {
         return(null);
     }
 }