Exemple #1
0
        public async Task <IActionResult> AddCard(
            [FromRoute] long boxId,
            [FromRoute] long trayId,
            [FromBody] CardCreationData data)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                var card = await _boxService.AddCard(User.GetId(), boxId, trayId, data);

                return(CreatedAtAction(nameof(GetCard), new { boxId, trayId, cardId = card.Id }, card));
            }
            catch (Exception e)
            {
                return(BadRequest(e));
            }
        }