public ActionResult Create(TaxEditModel taxEditModel) { PopulateDropDownLists(taxEditModel); if (ModelState.IsValid) { taxEditModel.UserId = CurrentUser; _taxService.CreateTax(taxEditModel); return(RedirectToAction("Index")); } return(View(taxEditModel)); }
public void Post([FromBody] TaxDetails createdObj) { _TaxService.CreateTax(createdObj); }
public ActionResult CreateTax(MainApplication mainapp, FormCollection frmcollection) { MainApplication main = new MainApplication() { MainTaxMasters = new MainTaxMaster(), SubTaxMasters = new SubTaxMaster(), }; Int32 sid = Convert.ToInt32(mainapp.MainTaxMasters.State); var state = _stateservice.GetStateNamebyId(sid); main.MainTaxMasters.Country = mainapp.MainTaxMasters.Country; main.MainTaxMasters.State = state; main.MainTaxMasters.VAT = mainapp.MainTaxMasters.VAT; main.MainTaxMasters.SalesTax = mainapp.MainTaxMasters.SalesTax; main.MainTaxMasters.OtherTax = mainapp.MainTaxMasters.OtherTax; main.MainTaxMasters.Status = "Active"; main.MainTaxMasters.ModifiedOn = DateTime.Now; _taxservice.CreateTax(main.MainTaxMasters); string submaster = frmcollection["hdnRowCount"].ToString(); if (!string.IsNullOrEmpty(submaster)) { int count = Convert.ToInt32(submaster); for (int i = 1; i <= count; i++) { string taxtype = "taxtype" + i; string city = "city" + i; string fromdate = "fromdate" + i; string todate = "todate" + i; string percentage = "percentage" + i; string finaltaxtype = frmcollection[taxtype]; string finalcity = frmcollection[city]; DateTime finalfromdate = Convert.ToDateTime(frmcollection[fromdate]); DateTime finaltodate = Convert.ToDateTime(frmcollection[todate]); double finalpercentage = Convert.ToDouble(frmcollection[percentage]); main.SubTaxMasters.FromDate = finalfromdate; main.SubTaxMasters.ToDate = finaltodate; main.SubTaxMasters.City = finalcity; main.SubTaxMasters.TaxType = finaltaxtype; main.SubTaxMasters.Percentage = finalpercentage; main.SubTaxMasters.Status = "Active"; main.SubTaxMasters.ModifiedOn = DateTime.Now; if (main.SubTaxMasters.TaxType == "VAT") { main.SubTaxMasters.Code = mainapp.MainTaxMasters.VAT; } if (main.SubTaxMasters.TaxType == "SalesTax") { main.SubTaxMasters.Code = mainapp.MainTaxMasters.SalesTax; } if (main.SubTaxMasters.TaxType == "OtherTax") { main.SubTaxMasters.Code = mainapp.MainTaxMasters.OtherTax; } _subtaxservice.CreateSubTax(main.SubTaxMasters); } } var tax = _taxservice.getLastInsertedTax(); return(RedirectToAction("CreateTax", "Tax")); }