public static TravelReporting GetTravelReporting(TravelReportingDTO dtoTravelReporting)
        {
            TravelReporting travelReporting = new TravelReporting()
            {
                IdTravelingDriver = dtoTravelReporting.IdTravelingDriver,
                Date            = dtoTravelReporting.Date,
                NumPassengers   = dtoTravelReporting.NumPassengers,
                NumComplainants = dtoTravelReporting.NumComplainants,
                IsPay           = dtoTravelReporting.IsPay
            };

            return(travelReporting);
        }
        public static TravelReportingDTO GetTravelReportingDTO(TravelReporting travelReporting)
        {
            if (travelReporting == null)
            {
                return(null);
            }
            TravelReportingDTO dtoTravelReporting = new TravelReportingDTO()
            {
                IdTravelingDriver = travelReporting.IdTravelingDriver,
                Date            = travelReporting.Date,
                NumPassengers   = travelReporting.NumPassengers,
                NumComplainants = travelReporting.NumComplainants,
                IsPay           = travelReporting.IsPay
            };

            return(dtoTravelReporting);
        }
 public static void AddTravelReport(int travelingId, DateTime date)
 {
     try
     {
         using (Travel_In_GroupDBEntities ctx = new Travel_In_GroupDBEntities())
         {
             var             travelDate      = ctx.TravelDriverRanges.FirstOrDefault(t => t.Id == travelingId && t.Date.Date == date.Date);
             var             travel          = ctx.TravelingDrivers.FirstOrDefault(t => t.TravelingIdDriver == travelingId);
             int             numPassenger    = travel.NumSeats - travelDate.NumSeatsAvailable;
             TravelReporting travelReporting = new TravelReporting()
             {
                 IdTravelingDriver = travelingId,
                 Date            = date,
                 NumPassengers   = numPassenger,
                 NumComplainants = 0,
                 IsPay           = false
             };
             ctx.TravelReportings.Add(travelReporting);
             ctx.SaveChanges();
         }
     }
     catch { throw; }
 }