public CheckoutDto GetCheckoutByDate(GetCheckoutByDateDto data, StaffMemberDto staffMemberDto) { DateTime shiftDate = Convert.ToDateTime(data.StringDate).Date; CheckoutEntity checkoutEntity = _repository.GetCheckOutForStaffMemberForSpecificDate(shiftDate, staffMemberDto.Id, data.LunchOrDinner); if (checkoutEntity == null) { throw new KeyNotFoundException("No checkout for the provided staffmember was found for the given parameters."); } CheckoutDto checkoutDto = Mapper.Map <CheckoutDto>(checkoutEntity); return(checkoutDto); }