Exemplo n.º 1
0
        public BaseResponse <TimeLineEventOutputDto> Create(TimeLineEventInputDto entity)
        {
            var timeLineEvent = Create(Mapper.Map <TimeLineEvent>(entity), out var isSaved);

            if (!isSaved)
            {
                throw new InternalServerErrorException(string.Format(Error.CreateError, entity.UserId));
            }

            return(new SuccessResponse <TimeLineEventOutputDto>(Mapper.Map <TimeLineEventOutputDto>(timeLineEvent)));
        }
Exemplo n.º 2
0
        public BaseResponse <TimeLineEventOutputDto> Update(Guid id, TimeLineEventInputDto @event)
        {
            var timeLineEvent = First(x => x.EntityStatus == EntityStatus.Activated && x.Id == id);

            timeLineEvent.Event = @event.Event;
            var isSaved = Update(timeLineEvent);

            if (!isSaved)
            {
                throw new InternalServerErrorException(string.Format(Error.CreateError, @event.Event));
            }

            return(new SuccessResponse <TimeLineEventOutputDto>(Mapper.Map <TimeLineEventOutputDto>(timeLineEvent)));
        }
 public BaseResponse <TimeLineEventOutputDto> Update(Guid id, [FromBody] TimeLineEventInputDto @event)
 {
     return(_timeLineEventService.Update(id, @event));
 }
 public BaseResponse <TimeLineEventOutputDto> Create([FromBody] TimeLineEventInputDto @event)
 {
     return(_timeLineEventService.Create(@event));
 }