示例#1
0
        internal async Task <Shared.Billet> CreateBillet(Shared.Billet billet)
        {
            await _AirTechContext.Billet.AddAsync(ConvertToDal(billet));

            await _AirTechContext.SaveChangesAsync();

            List <Models.Billet> billets = _AirTechContext.Billet.Include(x => x.Voyager).OrderByDescending(t => t.Id).ToList();

            Models.Billet final = billets.FirstOrDefault <Models.Billet>();
            return(ConvertToEndPoint(final));
        }
示例#2
0
 public async Task <Shared.Billet> CreateBillet(Shared.Billet billet)
 {
     try
     {
         return(await _dao.CreateBillet(billet));
     }
     catch (Exception e)
     {
         Console.Error.WriteLine(e.ToString());
         return(null);
     }
 }
示例#3
0
        public static Models.Billet ConvertToDal(Shared.Billet model)
        {
            var b = new Models.Billet
            {
                IdTravel  = model.IdTravel,
                Id        = model.Id,
                IdOrder   = model.IdOrder,
                UnitPrice = model.UnitPrice,
                Date      = model.Date,
                VoyagerId = model.VoyagerId
            };

            if (model.Voyager != null)
            {
                b.Voyager = VoyagerDAO.ConvertToDal(model.Voyager);
            }
            return(b);
        }
示例#4
0
        public static Shared.Billet ConvertToEndPoint(Business.Billet model)
        {
            var bil = new Shared.Billet
            {
                IdTravel  = model.IdTravel,
                Id        = model.Id,
                IdOrder   = model.IdOrder,
                UnitPrice = model.UnitPrice,
                Date      = model.Date,
                VoyagerId = model.VoyagerId,
            };

            if (model.Voyager != null)
            {
                bil.Voyager = VoyagerDAO.ConvertToEndPoint(model.Voyager, false);
            }
            return(bil);
        }