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)); }
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); } }
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); }
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); }