コード例 #1
0
        /// <summary>
        /// 删除订单
        /// </summary>
        /// <returns></returns>
        public IActionResult DeleteOrder(int orderId)
        {
            var order = _BJDbContext.Find <Order>(orderId);

            _BJDbContext.Remove <Order>(order);
            _BJDbContext.SaveChanges();
            return(RedirectToAction("OrderList"));
        }
コード例 #2
0
        public IActionResult UpdateInventoryInfo(InventoryInfo inventoryInfo)
        {
            var inventory = _BJDbContext.InventoryInfo.Where(i => i.MaterialName == inventoryInfo.MaterialName && i.DepotSite == inventoryInfo.DepotSite && i.Id != inventoryInfo.Id).FirstOrDefault();

            if (inventory != null)
            {
                inventory.RemainCount += inventoryInfo.RemainCount;
                inventory.TotalCount  += inventoryInfo.TotalCount;
                inventory.Remark       = inventoryInfo.Remark;
                inventory.UpdateDate   = DateTime.Now;
                var oldInventoryInfo = _BJDbContext.Find <InventoryInfo>(inventoryInfo.Id);
                _BJDbContext.Remove(oldInventoryInfo);
            }
            else
            {
                var oldInventoryInfo = _BJDbContext.Find <InventoryInfo>(inventoryInfo.Id);
                oldInventoryInfo.MaterialName = inventoryInfo.MaterialName;
                oldInventoryInfo.RemainCount  = inventoryInfo.RemainCount;
                oldInventoryInfo.TotalCount   = inventoryInfo.TotalCount;
                oldInventoryInfo.DepotSite    = inventoryInfo.DepotSite;
                oldInventoryInfo.Remark       = inventoryInfo.Remark;
                oldInventoryInfo.UpdateDate   = DateTime.Now;
                _BJDbContext.Update(oldInventoryInfo);
            }
            _BJDbContext.SaveChanges();
            return(RedirectToAction("InventoryList"));
        }
コード例 #3
0
        /// <summary>
        /// 删除不良品信息
        /// </summary>
        /// <returns></returns>
        public IActionResult DeleteInferiorProduct(int badPartId)
        {
            var badPart = _BJDbContext.Find <BadPart>(badPartId);

            _BJDbContext.Remove <BadPart>(badPart);
            _BJDbContext.SaveChanges();
            return(RedirectToAction("InferiorProduct"));
        }
コード例 #4
0
        /// <summary>
        /// 删除工序
        /// </summary>
        /// <returns></returns>
        public IActionResult DeleteProcessInfo(int processInfoId)
        {
            var processInfo = _BJDbContext.Find <ProcessInfo>(processInfoId);

            _BJDbContext.Remove <ProcessInfo>(processInfo);
            _BJDbContext.SaveChanges();
            return(RedirectToAction("ProcessInfoList"));
        }