Beispiel #1
0
        public ResponseDto <List <AddressDistrictDto> > GetDistrictList(AddressGetDistrictListCriteriaDto criteriaDto)
        {
            AddressGetDistrictListCriteriaBo criteriaBo = new AddressGetDistrictListCriteriaBo()
            {
                CityId = criteriaDto.CityId,

                Session = Session
            };

            ResponseBo <List <AddressDistrictBo> > responseBo = addressBusiness.GetDistrictList(criteriaBo);

            ResponseDto <List <AddressDistrictDto> > responseDto = responseBo.ToResponseDto <List <AddressDistrictDto>, List <AddressDistrictBo> >();

            if (responseBo.IsSuccess && responseBo.Bo != null)
            {
                responseDto.Dto = new List <AddressDistrictDto>();
                foreach (AddressDistrictBo itemBo in responseBo.Bo)
                {
                    responseDto.Dto.Add(new AddressDistrictDto()
                    {
                        Id     = itemBo.Id,
                        CityId = itemBo.CityId,
                        Name   = itemBo.Name
                    });
                }
            }

            return(responseDto);
        }
Beispiel #2
0
        public ResponseBo <List <AddressDistrictBo> > GetDistrictList(AddressGetDistrictListCriteriaBo criteriaBo)
        {
            ResponseBo <List <AddressDistrictBo> > responseBo = new ResponseBo <List <AddressDistrictBo> >();

            try
            {
                using (SqlConnection conn = DbAccess.Connection.GetConn())
                {
                    var p = new DynamicParameters();
                    base.AddStandartSpParams(ref p, criteriaBo);

                    p.Add("@CityId", criteriaBo.CityId, DbType.Int32, ParameterDirection.Input);

                    responseBo.Bo        = conn.Query <AddressDistrictBo>("spAddressDistrictList", p, commandType: CommandType.StoredProcedure).ToList();
                    responseBo.Message   = p.Get <string>("@Message");
                    responseBo.IsSuccess = p.Get <bool>("@IsSuccess");
                }
            }
            catch (Exception ex)
            {
                responseBo = base.SaveExLog(ex, this.GetType(), MethodBase.GetCurrentMethod().Name, criteriaBo).ToResponse <List <AddressDistrictBo> >();
            }

            return(responseBo);
        }