Пример #1
0
        public IActionResult AddRegion(HotelRegion region)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var returnRegion = _hotelsRepository.Add(region);

            return(Ok(returnRegion));
        }
Пример #2
0
        public IActionResult Remove(HotelRegionSearcher region)
        {
            if (region.Id == null)
            {
                return(BadRequest(ModelState));
            }

            HotelRegion temp = null;

            try
            {
                temp = _hotelsRepository.Remove(region.ToHotelRegion());
            }
            catch (InvalidOperationException ioe)
            {
                return(NotFound(ioe.Message));
            }
            return(Ok(temp));
        }