コード例 #1
0
 public async Task <Photo> GetSingleAsync(int photoId)
 {
     using (var context = new AluPlastContext())
     {
         return(await context.Photos.FindAsync(photoId));
     }
 }
コード例 #2
0
        public async Task AddAsync(int loadId, Item item)
        {
            using (var context = new AluPlastContext())
            {
                context.Items.Add(item);

                await context.SaveChangesAsync();
            }
        }
コード例 #3
0
        public async Task AddAsync(Photo photo)
        {
            using (var context = new AluPlastContext())
            {
                context.Photos.Add(photo);

                await context.SaveChangesAsync();
            }
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
        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;
            }
        }
コード例 #6
0
        public async Task UpdateAsync(Load load)
        {
            using(var context = new AluPlastContext())
            {
                var foundLoad = await context.Loads.FindAsync(load.LoadId);

                foundLoad = load;

                await context.SaveChangesAsync();

            }
        }
コード例 #7
0
        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();

            }
        }