コード例 #1
0
        public void CheckInItem(int id)
        {
            // this is for same time in db
            var now = DateTime.Now;

            var item = _context.WarehouseAssets.FirstOrDefault(a => a.Id == id);

            _context.Update(item);

            var checkout = _context.Checkouts.Include(c => c.WarehouseAsset).Include(c => c.WarehouseEmployeeCard).FirstOrDefault(a => a.WarehouseAsset.Id == id);

            if (checkout != null)
            {
                _context.Remove(checkout);
            }

            var history = _context.CheckoutHistories.Include(h => h.WarehouseAsset).Include(h => h.WarehouseEmployeeCard).FirstOrDefault(h => h.WarehouseAsset.Id == id && h.CheckedIn == null);

            if (history != null)
            {
                _context.Update(history);
                history.CheckedIn = now;
            }

            item.Status = _context.Statuses.FirstOrDefault(a => a.Name == "Available");

            Save();
        }
コード例 #2
0
 public void Edit(Employee employee)
 {
     _context.Update(employee);
     Save();
 }
コード例 #3
0
 public void Edit(WarehouseBranch branch)
 {
     _context.Update(branch);
     Save();
 }
コード例 #4
0
 public void Edit(Status status)
 {
     _context.Update(status);
     Save();
 }
コード例 #5
0
 public void Edit(WarehouseAsset asset)
 {
     _context.Update(asset);
     Save();
 }