예제 #1
0
        public JsonResult <APIResultEntities <AcountsEntities> > Get(Guid id)
        {
            APIResultEntities <AcountsEntities> rs = new APIResultEntities <AcountsEntities>();

            try
            {
                var data = _iAccountServices.GetAccountById(id);
                if (data != null)
                {
                    rs.Data           = data;
                    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));
        }