Пример #1
0
        public async Task <ActionResult <Grunt> > CreateGrunt([FromBody] Grunt grunt)
        {
            try
            {
                Grunt createdGrunt = await _context.CreateGrunt(grunt);

                return(CreatedAtRoute(nameof(GetGrunt), new { id = createdGrunt.Id }, createdGrunt));
            }
            catch (ControllerNotFoundException e)
            {
                return(NotFound(e.Message));
            }
            catch (ControllerBadRequestException e)
            {
                return(BadRequest(e.Message));
            }
        }