예제 #1
0
        public async Task<IHttpActionResult> Exist(CityDto dto)
        {
            City city = new City
            {
                CityName = dto.CityName,
                ProvinceName = dto.ProvinceName
            };

            return this.Ok(new BoolResponse { Result = await this.cityService.Exist(city) });
        }
예제 #2
0
        public async Task<IHttpActionResult> Create(CityDto dto)
        {
            City city = new City
            {
                CityName = dto.CityName,
                ProvinceName = dto.ProvinceName
            };

            if (await this.cityService.Exist(city))
            {
                return this.BadRequest("城市信息已经存在");
            }

            return this.Ok((await this.cityService.Create(city)).ToDto());
        }