Ejemplo n.º 1
0
        public BaseResponse <WorkLogOutputDto> Create(WorkLogInputDto workLogInputDto)
        {
            var entity = Create(Mapper.Map <WorkLog>(workLogInputDto), out var isSaved);

            if (!isSaved)
            {
                throw new BadRequestException($"Could not log work for task: {workLogInputDto.TaskId}");
            }

            return(new SuccessResponse <WorkLogOutputDto>(Mapper.Map <WorkLogOutputDto>(entity)));
        }
Ejemplo n.º 2
0
        public BaseResponse <WorkLogOutputDto> Update(Guid id, WorkLogInputDto workLogInputDto)
        {
            var workLog = First(x => x.EntityStatus == EntityStatus.Activated && x.Id == id);

            workLog.Amount      = workLogInputDto.Amount;
            workLog.DateLog     = workLogInputDto.DateLog;
            workLog.Description = workLogInputDto.Description;

            var isSaved = Update(workLog);

            if (!isSaved)
            {
                throw new BadRequestException($"Could not update work log for task: {workLogInputDto.TaskId}");
            }

            return(new SuccessResponse <WorkLogOutputDto>(Mapper.Map <WorkLogOutputDto>(workLog)));
        }
Ejemplo n.º 3
0
 public BaseResponse <WorkLogOutputDto> Update(Guid id, [FromBody] WorkLogInputDto workLogInputDto)
 {
     return(_workLogService.Update(id, workLogInputDto));
 }
Ejemplo n.º 4
0
 public BaseResponse <WorkLogOutputDto> Create([FromBody] WorkLogInputDto workLogInputDto)
 {
     return(_workLogService.Create(workLogInputDto));
 }