Beispiel #1
0
        public async Task <IActionResult> CreatePark(Parky park)
        {
            // TODO rewrite using DTOs
            await _repository.CreatePark(park);

            _repository.Save();

            return(Created("GetPark", park));
        }
Beispiel #2
0
        public async Task <IActionResult> UpdatePark(Parky park)
        {
            try
            {
                _repository.UpdatePark(park);
                _repository.Save();

                return(Ok(park));
            }
            catch (Exception e)
            {
                _logger.LogError($"Could not find an element to update");
                return(StatusCode(500, "Something went wrong"));
            }
        }