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));
        }
Beispiel #3
0
        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));
        }
Beispiel #5
0
        public ActionResult DeleteConfirmed(int id)
        {
            SaleTaxType saleTaxType = db.SaleTaxTypes.Find(id);

            db.SaleTaxTypes.Remove(saleTaxType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #6
0
 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));
 }
Beispiel #7
0
        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));
        }
Beispiel #8
0
        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));
        }
Beispiel #9
0
        // 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));
        }