public IHttpActionResult Delete(int id) { PartsPurchaseRecords _purchaseRecords = _unitOfWork.PartsPurchaseRecords.GetPurchaseRecordsWithId(id); Inventory _inventory = _unitOfWork.Inventory.GetInventoryByPartsId(id); if (_inventory == null || _purchaseRecords.IsDelete) { return(NotFound()); } }
public void AddRecord(PartsPurchaseRecordsViewModel ViewModel) { var _PartsPurchaseRecords = new PartsPurchaseRecords { PartsId = ViewModel.PartsId, PurchaseDate = ViewModel.PurchaseDate, PurchasePrice = ViewModel.PurchasePrice, PurchaseQty = ViewModel.PurchaseQty, SuppliersId = ViewModel.SuppliersId }; _context.PartsPurchaseRecords.Add(_PartsPurchaseRecords); }
public ActionResult Edit(int id) { PartsPurchaseRecords _purchaseRecord = _unitOfWork.PartsPurchaseRecords.GetPurchaseRecordsWithId(id); var viewModel = new PartsPurchaseRecordsViewModel() { Heading = "Edit Purchase Records", Id = _purchaseRecord.Id, Parts = _unitOfWork.Parts.GetAllPartsIncludeDeleted(), Suppliers = _unitOfWork.Suppliers.GetAllSuppliers(), PartsId = _purchaseRecord.PartsId, PurchaseDate = Convert.ToDateTime(_purchaseRecord.PurchaseDate.ToShortDateString()), PurchasePrice = _purchaseRecord.PurchasePrice, PurchaseQty = _purchaseRecord.PurchaseQty, SuppliersId = _purchaseRecord.SuppliersId }; return(View("AddRecords", viewModel)); }