public async Task <IActionResult> PutSaleTaxType(int id, SaleTaxType saleTaxType) { if (id != saleTaxType.SaleTaxTypeId) { return(BadRequest()); } _context.Entry(saleTaxType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SaleTaxTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <SaleTaxType> > PostSaleTaxType(SaleTaxType saleTaxType) { _context.SaleTaxTypes.Add(saleTaxType); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSaleTaxType", new { id = saleTaxType.SaleTaxTypeId }, saleTaxType)); }
private int CreateSaleTax(VoyagerContext db, ImportSaleItemWise item) { // Always GST and with Local Sale //Calulate Rate decimal rate = 0; rate = ((item.SGST + item.CGST) * 100) / item.BasicRate; int taxId = 1; try { taxId = db.SaleTaxTypes.Where(c => c.CompositeRate == rate).FirstOrDefault().SaleTaxTypeId; return(taxId); } catch (Exception) { SaleTaxType taxType = new SaleTaxType { CompositeRate = rate, TaxName = "OutPut Tax GST(CGST+SGST) @" + rate, TaxType = TaxType.GST }; db.SaleTaxTypes.Add(taxType); db.SaveChanges(); return(taxType.SaleTaxTypeId); } }
public async Task <IActionResult> Edit(int id, [Bind("SaleTaxTypeId,TaxName,TaxType,CompositeRate")] SaleTaxType saleTaxType) { if (id != saleTaxType.SaleTaxTypeId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(saleTaxType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SaleTaxTypeExists(saleTaxType.SaleTaxTypeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(PartialView(saleTaxType)); }
public ActionResult DeleteConfirmed(int id) { SaleTaxType saleTaxType = db.SaleTaxTypes.Find(id); db.SaleTaxTypes.Remove(saleTaxType); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "SaleTaxTypeId,TaxName,TaxType,CompositeRate")] SaleTaxType saleTaxType) { if (ModelState.IsValid) { db.Entry(saleTaxType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(saleTaxType)); }
public async Task <IActionResult> Create([Bind("SaleTaxTypeId,TaxName,TaxType,CompositeRate")] SaleTaxType saleTaxType) { if (ModelState.IsValid) { _context.Add(saleTaxType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(saleTaxType)); }
public ActionResult Create([Bind(Include = "SaleTaxTypeId,TaxName,TaxType,CompositeRate")] SaleTaxType saleTaxType) { if (ModelState.IsValid) { db.SaleTaxTypes.Add(saleTaxType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(saleTaxType)); }
// GET: SaleTaxTypes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SaleTaxType saleTaxType = db.SaleTaxTypes.Find(id); if (saleTaxType == null) { return(HttpNotFound()); } return(View(saleTaxType)); }