public async Task <IActionResult> Post(long group, [FromBody] LabelAddModel value)
        {
            var userId = _validateHelper.GetUserId(HttpContext);

            try
            {
                var model = await _labelService.AddAsync(userId, group, value);

                if (model == null)
                {
                    return(BadRequest());
                }

                return(Ok(model));
            }
            catch (ForbidException)
            {
                return(Forbid());
            }
            catch (KeyNotFoundException)
            {
                return(BadRequest());
            }
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> AddNewLabel([FromBody] LabelPostDto labelPostDto)
        {
            var labelResp = await labelService.AddAsync(labelPostDto);

            return(CreatedAtAction("GetClient", new { id = labelResp.ID }, mapper.Map <LabelResponseDto>(labelResp)));
        }