Ejemplo n.º 1
0
        public BusinessResult UpdateUser(BOUser objUser)
        {
            BusinessResult result = new BusinessResult();

            using (var conexion = Util.GetConnection())
            {
                conexion.Open();
                using (var objPE = new UserPE())
                {
                    try
                    {
                        objPE.UpdateUser(conexion, objUser);

                        result.Success = true;
                        result.Other   = objUser;
                    }
                    catch (Exception error)
                    {
                        result.ErrorsList.Add(error.Message);
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        public BusinessResult GetUserById(int id)
        {
            BusinessResult result = new BusinessResult();

            using (var conexion = Util.GetConnection())
            {
                conexion.Open();
                using (var objPE = new UserPE())
                {
                    try
                    {
                        BOUser objUser = objPE.GetUserById(conexion, id);

                        if (objUser == null)
                        {
                            result.ErrorsList.Add("Record not found.");
                        }
                        else
                        {
                            result.Success = true;
                            result.Other   = objUser;
                        }
                    }
                    catch (Exception error)
                    {
                        throw new Exception(error.Message);
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 3
0
        public List <BOUser> GetAllUsers()
        {
            List <BOUser> result = new List <BOUser>();

            using (var conexion = Util.GetConnection())
            {
                conexion.Open();
                using (var objPE = new UserPE())
                {
                    result = objPE.GetAllUsers(conexion);
                }
            }
            return(result);
        }