public async Task <Photo> GetSingleAsync(int photoId) { using (var context = new AluPlastContext()) { return(await context.Photos.FindAsync(photoId)); } }
public async Task AddAsync(int loadId, Item item) { using (var context = new AluPlastContext()) { context.Items.Add(item); await context.SaveChangesAsync(); } }
public async Task AddAsync(Photo photo) { using (var context = new AluPlastContext()) { context.Photos.Add(photo); await context.SaveChangesAsync(); } }
public async Task <IList <Item> > GetAsync(int loadId) { using (var context = new AluPlastContext()) { var load = await context.Loads .Include(path => path.Items) .SingleOrDefaultAsync(p => p.LoadId == loadId); return(load?.Items); } }
public async Task<IList<Load>> GetAsync(DateTime date) { using (var context = new AluPlastContext()) { var loads = await context.Loads .Where(p => p.LoadDate == date) .ToListAsync(); return loads; } }
public async Task UpdateAsync(Load load) { using(var context = new AluPlastContext()) { var foundLoad = await context.Loads.FindAsync(load.LoadId); foundLoad = load; await context.SaveChangesAsync(); } }
public void Confirm(int loadId, User @operator) { using (var context = new AluPlastContext()) { var foundLoad = context.Loads.Find(loadId); foundLoad.Operator = @operator; foundLoad.LoadStatus = LoadStatus.Done; context.SaveChanges(); } }