Esempio n. 1
0
        public async Task <ActionResult <GruntCommand> > CreateGruntCommand([FromBody] GruntCommand gruntCommand)
        {
            try
            {
                gruntCommand.Grunt = await _service.GetGrunt(gruntCommand.GruntId);

                GruntCommand createdCommand = await _service.CreateGruntCommand(gruntCommand);

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