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))); }
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))); }
public BaseResponse <WorkLogOutputDto> Update(Guid id, [FromBody] WorkLogInputDto workLogInputDto) { return(_workLogService.Update(id, workLogInputDto)); }
public BaseResponse <WorkLogOutputDto> Create([FromBody] WorkLogInputDto workLogInputDto) { return(_workLogService.Create(workLogInputDto)); }