示例#1
0
        public async Task <HttpResponseMessage> GetById([FromUri] CountryBaseReq req)
        {
            var obj = await CountryBE.GetById(req);

            if (obj != null)
            {
                return(this.OkResult(obj));
            }

            return(this.ErrorResult(new Error(EnumError.CountryNotExist)));
        }
示例#2
0
        public async Task <Country> GetById(CountryBaseReq req)
        {
            var obj = await GetAsync(c => c.CountryCode == req.CountryCode);

            if (obj != null &&
                obj.Any())
            {
                return(obj.FirstOrDefault());
            }

            return(null);
        }
示例#3
0
        public async Task <HttpResponseMessage> Delete(CountryBaseReq req)
        {
            var obj = await CountryBE.GetById(req);

            if (obj == null)
            {
                return(this.ErrorResult(new Error(EnumError.CountryNotExist)));
            }

            if (CountryBE.Delete(obj))
            {
                return(this.OkResult());
            }
            else
            {
                return(this.ErrorResult(new Error(EnumError.DeleteFailse)));
            }
        }