public ActionResult DeleteConfirmed(int id) { ImportSaleRegister importSaleRegister = db.ImportSaleRegisters.Find(id); db.ImportSaleRegisters.Remove(importSaleRegister); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ImportSaleRegisterId,InvoiceNo,InvoiceType,InvoiceDate,Quantity,MRP,Discount,BasicRate,Tax,RoundOff,BillAmnt,PaymentType,ImportTime")] ImportSaleRegister importSaleRegister) { if (ModelState.IsValid) { db.Entry(importSaleRegister).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(importSaleRegister)); }
public async Task <IActionResult> Create([Bind("ImportSaleRegisterId,InvoiceNo,InvoiceType,InvoiceDate,Quantity,MRP,Discount,BasicRate,Tax,RoundOff,BillAmnt,PaymentType,IsConsumed,ImportTime")] ImportSaleRegister importSaleRegister) { if (ModelState.IsValid) { _context.Add(importSaleRegister); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(importSaleRegister)); }
private int ImportSaleRegister(VoyagerContext db, string StoreCode, string fileName) { //string rootFolder = IHostingEnvironment.WebRootPath; //string fileName = @"ImportCustomers.xlsx"; FileInfo file = new FileInfo(fileName); using ExcelPackage package = new ExcelPackage(file); ExcelWorksheet workSheet = package.Workbook.Worksheets ["Sheet1"]; int totalRows = workSheet.Dimension.Rows; int StoreID = 1;//Default StoreID = db.Stores.Where(c => c.StoreCode == StoreCode).Select(c => c.StoreId).FirstOrDefault(); if (StoreID < 1) { StoreID = 1; } List <ImportSaleRegister> saleList = new List <ImportSaleRegister> (); //GRNNo GRNDate Invoice No Invoice Date Supplier Name Barcode Product Name Style Code Item Desc Quantity MRP MRP Value Cost Cost Value TaxAmt ExmillCost Excise1 Excise2 Excise3 int xo = 0; for (int i = 2; i <= totalRows; i++) { //Invoice No 1 Invoice Date 2 Invoice Type 3 //Brand Name 4 Product Name 5 Item Desc 6 HSN Code 7 BAR CODE 8 // //Style Code 9 Quantity 10 MRP 11 Discount Amt 12 Basic Amt 13 Tax Amt 14 SGST Amt 15 //CGST Amt 16 CESS Amt 17 Line Total 18 Round Off 19 Bill Amt 20 Payment Mode 21 SalesMan Name 22 // //Coupon % Coupon Amt SUB TYPE Bill Discount LP Flag Inst Order CD TAILORING FLAG ImportSaleRegister p = new ImportSaleRegister { InvoiceNo = workSheet.Cells [i, 1].Value.ToString(), InvoiceDate = workSheet.Cells [i, 2].Value.ToString(), InvoiceType = workSheet.Cells [i, 3].Value.ToString(), Quantity = (double)workSheet.Cells [i, 4].Value, MRP = (decimal)workSheet.Cells [i, 5].GetValue <decimal> (), Discount = (decimal)workSheet.Cells [i, 6].GetValue <decimal> (), BasicRate = (decimal)workSheet.Cells [i, 7].GetValue <decimal> (), Tax = (decimal)workSheet.Cells [i, 8].GetValue <decimal> (), RoundOff = (decimal)workSheet.Cells [i, 9].GetValue <decimal> (), BillAmnt = (decimal)workSheet.Cells [i, 10].GetValue <decimal> (), PaymentType = workSheet.Cells [i, 11].Value.ToString(), StoreId = StoreID, IsConsumed = false }; saleList.Add(p); xo++; } db.ImportSaleRegisters.AddRange(saleList); return(db.SaveChanges()); //return purchaseList; }
// GET: ImportSaleRegisters/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ImportSaleRegister importSaleRegister = db.ImportSaleRegisters.Find(id); if (importSaleRegister == null) { return(HttpNotFound()); } return(View(importSaleRegister)); }
[Authorize(Roles = "Admin,PowerUser")] public async Task <IActionResult> Edit(int id, [Bind("ImportSaleRegisterId,InvoiceNo,InvoiceType,InvoiceDate,Quantity,MRP,Discount,BasicRate,Tax,RoundOff,BillAmnt,PaymentType,IsConsumed,ImportTime")] ImportSaleRegister importSaleRegister) { if (id != importSaleRegister.ImportSaleRegisterId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(importSaleRegister); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ImportSaleRegisterExists(importSaleRegister.ImportSaleRegisterId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(importSaleRegister)); }