Example #1
0
        public async Task <IActionResult> AddTray([FromRoute] long boxId, [FromBody] TrayCreationData creationData)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                var tray = await _boxService.AddTray(User.GetId(), boxId, creationData);

                return(CreatedAtAction(nameof(GetTray), new { boxId, trayId = tray.Id }, tray));
            }
            catch (Exception e)
            {
                return(BadRequest());
            }
        }