public async Task CreateTravelRoute(TravelRoute tl) { if (tl == null) { throw new ArgumentNullException(nameof(tl)); } _context.Routes.Add(tl); await _context.SaveChangesAsync(); }
public async Task <TravelPointOfInterest> CreateTravelPointOfInterest(TravelPointOfInterest tl) { if (tl == null) { throw new ArgumentNullException(nameof(tl)); } _context.Points.Add(tl); await _context.SaveChangesAsync(); return(await _context.Points.AsNoTracking().Include(x => x.ConnectedStartRoutes).Include(x => x.ConnectedEndRoutes).FirstOrDefaultAsync(p => p.TravelPointOfInterestID == tl.TravelPointOfInterestID)); }
public async Task <TravelTaskListItem> CreateTaskListItemAsync(TravelTaskListItem taskListItem) { if (taskListItem == null) { throw new ArgumentNullException(nameof(taskListItem)); } _context.Tasks.Add(taskListItem); await _context.SaveChangesAsync(); return(await _context.Tasks.AsNoTracking() .FirstOrDefaultAsync(p => p.TravelTaskListItemID == taskListItem.TravelTaskListItemID)); }
public async Task <TravelListItem> CreateTravelList(TravelListItem tl) { if (tl == null) { throw new ArgumentNullException(nameof(tl)); } _context.TravelLists.Add(tl); await _context.SaveChangesAsync(); return(await _context.TravelLists.AsNoTracking() .Include(x => x.Points).ThenInclude(p => p.ConnectedStartRoutes) .Include(x => x.Points).ThenInclude(p => p.ConnectedEndRoutes) .Include(x => x.Items).Include(x => x.Images).Include(x => x.Tasks) .Include(x => x.Routes) .FirstOrDefaultAsync(p => p.TravelListItemID == tl.TravelListItemID)); }
public async Task CreateCategory(Category category) { if (category == null) { throw new ArgumentNullException(nameof(category)); } _context.Categories.Add(category); await _context.SaveChangesAsync(); }