예제 #1
0
        public IActionResult AddRegion(Region region)
        {
            if (region == null)
            {
                return(BadRequest("Region is null"));
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                _regionRepository.CreateRegion(region);
                return(Ok(region.Id));
            }
            catch (Exception exception)
            {
                return(BadRequest(exception.Message));
            }
        }