public async Task <GetLimitsOperationResponse> Execute(GetLimitsOperationRequest request) { var employee = await _authorizationContext.CurrentEmployee(); var limit = await _limitRepository.GetByEmployeeIdAsync(employee.Id); var getRemainingLimitsRequest = new GetRemainingLimitsForQuarterOperationRequest { Quarter = request.Date.GetQuarter() }; var remainingLimit = await _getRemainingLimitsForQuarterOperation.Execute(getRemainingLimitsRequest); return(new GetLimitsOperationResponse { Id = limit.Id, AssignedLimit = new GetLimitsOperationResponse.Limit { DaysPerQuarter = limit.DaysPerQuarter, TopicsPerDay = limit.TopicsPerDay }, RemainingLimit = new GetLimitsOperationResponse.Limit { DaysPerQuarter = remainingLimit.DaysPerQuarter, TopicsPerDay = limit.TopicsPerDay } }); }
public async Task <ActionResult <LimitsModel> > GetLimits([Required] DateTime date) { var request = new GetLimitsOperationRequest { Date = date }; var response = await _getLimitsOperation.Execute(request); return(Ok(new LimitsModel(response))); }