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); } }
public UserView GetUserViewModel(string UserName) { try { var user = _UOF.Users.Get(UserName); return(_viewModelEngine.GetUserViewModel(user)); } catch (Exception exception) { return(null); } }