Esempio n. 1
0
        public JsonResult <APIResultEntities <List <AcountsEntities> > > Get()
        {
            APIResultEntities <List <AcountsEntities> > rs = new APIResultEntities <List <AcountsEntities> >();

            try
            {
                var data = _iAccountServices.GetAllAccount();
                if (data != null)
                {
                    var lst = data as List <AcountsEntities> ?? data.ToList();

                    rs.Data           = lst;
                    rs.ErrCode        = ErrorCodeEntites.Success;
                    rs.ErrDescription = string.Format(Constants.MSG_SELECT_SUCCESS, Constants.Account);
                }
                else
                {
                    rs.Data           = null;
                    rs.ErrCode        = ErrorCodeEntites.HaveNoData;
                    rs.ErrDescription = string.Format(Constants.MSG_SELECT_SUCCESS, Constants.Account);
                }
            }
            catch (Exception ex)
            {
                rs.Data           = null;
                rs.ErrCode        = ErrorCodeEntites.Fail;
                rs.ErrDescription = ex.ToString();
                throw new Exception(ex.ToString());
            }
            return(Json(rs));
        }