public DroneDetailView(int DroneID, int UserID = 0) { DroneInfo = new DroneInfo(DroneID); AccountInfo = new AccountInfo(DroneInfo.AccountID); var _FlightInfo = db .DroneFlight .Where(w => w.DroneID == DroneID && w.MaxAltitude > 5); if (UserID != 0) { _FlightInfo = _FlightInfo.Where(x => x.PilotID == UserID); } FlightInfo = _FlightInfo.Select(s => new FlightInfo { ID = s.ID, FlightDate = (DateTime)s.FlightDate, FlightDistance = (int)s.FlightDistance, FlightHours = (int)s.FlightHours, MaxAltitude = (int)s.MaxAltitude, PilotID = (int)s.PilotID }).Take(5).OrderByDescending(x => x.ID).ToList(); var PilotIDs = db .M2M_Drone_User .Where(w => w.DroneID == DroneID) .OrderBy(o => o.DroneID) .Select(s => s.UserID) .ToList(); PilotInfo = new List <ViewModel.PilotInfo>(); foreach (var PilotID in PilotIDs) { PilotInfo.Add(new ViewModel.PilotInfo(PilotID)); } }
public NOC_Details_Ext(NOC_Details det) { this.DroneID = det.DroneID; this.Coordinates = det.Coordinates; this.EndDate = det.EndDate; this.EndTime = det.EndTime; this.IsUseCamara = det.IsUseCamara; this.LOS = det.LOS; this.MaxAltitude = det.MaxAltitude; this.MinAltitude = det.MinAltitude; this.NocID = det.NocID; this.OuterCoordinates = det.OuterCoordinates; this.PilotID = det.PilotID; this.StartDate = det.StartDate; this.StartTime = det.StartTime; this.Status = det.Status; this.StatusChangedBy = det.StatusChangedBy; this.StatusChangedOn = det.StatusChangedOn; this.NocBuffer = det.NocBuffer; DroneInfo = new DroneInfo(det.DroneID); PilotInfo = new PilotInfo(det.PilotID); }
public DroneDetailView(string DroneName) { DroneInfo = new DroneInfo(DroneName); AccountInfo = new AccountInfo(DroneInfo.AccountID); }