public ListUserViewErrorModel GetList() { var returnModel = new ListUserViewErrorModel(); try { var userViewList = new List <UserView>(); var userList = _UOF.Users.GetList(); foreach (var user in userList) { var model = GetUserViewModel(user); userViewList.Add(model.Item); if (model.Error) { returnModel.Error = true; returnModel.ErrorMessage = model.ErrorMessage; return(returnModel); } } returnModel.Error = false; returnModel.Items = userViewList; return(returnModel); } catch (Exception exception) { returnModel.ErrorMessage = "Thomething goes wrong!"; returnModel.Error = true; return(returnModel); } }
public ListUserViewErrorModel GetListForTransactions(string currentUserName) { var returnMdel = new ListUserViewErrorModel(); var userViewList = new List <UserView>(); try { var userList = _UOF.Users.GetList(); foreach (var user in userList) { if (user.UserName != currentUserName) { var Model = GetUserViewModel(user); if (Model.Error) { returnMdel.Error = true; returnMdel.ErrorMessage = Model.ErrorMessage; return(returnMdel); } Model.Item.Balance = 0; userViewList.Add(Model.Item); } } returnMdel.Error = false; returnMdel.Items = userViewList; return(returnMdel); } catch (Exception exception) { returnMdel.Error = true; returnMdel.ErrorMessage = "Thomething goes wrong!"; return(returnMdel); } }