Ejemplo n.º 1
0
        public BaseResponse <LabelOutputDto> Create(LabelInputDto labelInputDto, Guid id)
        {
            var label = Create(Mapper.Map <Label>(labelInputDto), out var isSaved);

            if (!isSaved)
            {
                throw new InternalServerErrorException("Could not create label");
            }

            return(new SuccessResponse <LabelOutputDto>(Mapper.Map <LabelOutputDto>(label)));
        }
Ejemplo n.º 2
0
        public BaseResponse <bool> Update(Guid id, LabelInputDto labelInputDto)
        {
            var label = Mapper.Map <Label>(labelInputDto);

            label.Id = id;

            var isSaved = Update(label);

            if (!isSaved)
            {
                throw new InternalServerErrorException("Could not create label");
            }

            return(new SuccessResponse <bool>(true));
        }
Ejemplo n.º 3
0
 public BaseResponse <bool> Update(Guid id, [FromBody] LabelInputDto labelInputDto)
 {
     return(_labelService.Update(id, labelInputDto));
 }
Ejemplo n.º 4
0
        public BaseResponse <LabelOutputDto> Create([FromBody] LabelInputDto labelInputDto)
        {
            var userId = User.GetUserId();

            return(_labelService.Create(labelInputDto, userId));
        }