Ejemplo n.º 1
0
        public async Task addFlightDetailAsync(FlightDetailDTO det_dto)
        {
            var det = mapper.Map <FlightDetailDTO, FlightDetail>(det_dto);

            await generateDetailId(det);

            await unitOfWork.Flights.addFlightDetail(det);

            await unitOfWork.CompleteAsync();
        }
Ejemplo n.º 2
0
 public FlightDetailVM(FlightDetailDTO fd, AirportDTO Origin, AirportDTO Destination)
 {
     this.FlightId       = fd.FlightId;
     this.FlightDetailId = fd.FlightDetailId;
     this.RouteId        = fd.RouteId;
     this.OriginAirport  = Origin.AirportName;
     this.OriginCountry  = Origin.Address.Country;
     this.DesAirport     = Destination.AirportName;
     this.DesCountry     = Destination.Address.Country;
     this.ArrDate        = fd.ArrDate.ToString();
     this.DepDate        = fd.DepDate.ToString();
 }
Ejemplo n.º 3
0
        public async Task <IActionResult> OnPostEditFlight()
        {
            await Task.Run(() => true);

            string       respone = "True";
            MemoryStream stream  = new MemoryStream();

            Request.Body.CopyTo(stream);
            stream.Position = 0;
            using (StreamReader reader = new StreamReader(stream))
            {
                string requestBody = reader.ReadToEnd();
                if (requestBody.Length > 0)
                {
                    var obj = JsonConvert.DeserializeObject <EditFlightVM>(requestBody);
                    if (obj != null)
                    {
                        FlightDTO flight = new FlightDTO();
                        flight.FlightId = obj.FlightId;
                        flight.PlaneId  = obj.PlaneId;
                        if (obj.Status == "AVAILABLE")
                        {
                            flight.Status = STATUS.AVAILABLE;
                        }
                        else if (obj.Status == "DISABLED")
                        {
                            flight.Status = STATUS.DISABLED;
                        }

                        IList <FlightDetailDTO> detailDTO = new List <FlightDetailDTO>();
                        int n = obj.routeId.Count();
                        for (var i = 0; i < n; ++i)
                        {
                            DateTime        depDate = DateTime.ParseExact(obj.depDate[i], "dd-MM-yyyy hh:mm tt", null);
                            DateTime        arrDate = DateTime.ParseExact(obj.arrDate[i], "dd-MM-yyyy hh:mm tt", null);
                            FlightDetailDTO detail  = new FlightDetailDTO(null, null, obj.routeId[i], depDate, arrDate);
                            detailDTO.Add(detail);
                        }
                        await _services.updateFlightAsync(flight);

                        Console.WriteLine(flight.FlightId + " ggggg");
                        await _services.addFlightDetailRangeAsync(detailDTO, flight.FlightId);
                    }
                }
            }
            return(new JsonResult(respone));
        }
Ejemplo n.º 4
0
 public Task addFlightDetailAsync(FlightDetailDTO det_dto, IEnumerable <FlightDetailDTO> detail)
 {
     throw new NotImplementedException();
 }