예제 #1
0
        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);
            }
        }
예제 #2
0
        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);
            }
        }