Example #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)));
        }
Example #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));
        }
Example #3
0
 public BaseResponse <bool> Update(Guid id, [FromBody] LabelInputDto labelInputDto)
 {
     return(_labelService.Update(id, labelInputDto));
 }
Example #4
0
        public BaseResponse <LabelOutputDto> Create([FromBody] LabelInputDto labelInputDto)
        {
            var userId = User.GetUserId();

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