Пример #1
0
        private static void CreateUavForCM(CrewMember cm, DateTime start, DateTime end)
        {
            int hourIncrement = rand.Next(0, 6);
            cm.Unavailabilitys = new List<Unavailability>();
            do
            {
                Unavailability uav = new Unavailability();
                uav.Start = start.AddHours(hourIncrement);
                uav.End = uav.Start.AddHours(rand.Next(0, 6));
                uav.UnavailabilityID = Guid.NewGuid();
                uav.CrewMemberID = cm.CrewMemberID;

                uav.UnavailabilityReasonID = unavailabilityReasons.ElementAt(rand.Next(0, unavailabilityReasons.Count())).UnavailabilityReasonID;
                cm.Unavailabilitys.Add(uav);

                hourIncrement += rand.Next(0, 14);
            } while (start.AddHours(hourIncrement) <= end);
        }
 public void InsertUnavailability(Unavailability unavailability)
 {
     _ctx.Unavailability.Add(unavailability);
 }