Example #1
0
        public void Delete(int id)
        {
            var employee = GetById(id);

            _context.Remove(employee);
            Save();
        }
        public void Delete(int id)
        {
            var branch = GetById(id);

            _context.Remove(branch);
            Save();
        }
        public void Delete(int id)
        {
            var asset = GetById(id);

            _context.Remove(asset);
            Save();
        }
Example #4
0
        public void Delete(int id)
        {
            var status = GetById(id);

            _context.Remove(status);
            Save();
        }
Example #5
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();
        }