public ActionResult AddSacCodes(SacCodesModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             using (var con = new SqlConnection(_connectionString))
             {
                 var result = con.Query <int>("Add_Edit_Delete_SACCodes",
                                              new
                 {
                     model.SacCodesId,
                     model.CountryId,
                     model.StateId,
                     model.Applicable_Tax,
                     model.GstCategoryId,
                     model.GstHeading,
                     model.Gst_HSN_Code,
                     model.CTH_Number,
                     model.SAC,
                     //model.Product_Sale_Range,
                     Product_Sale_Range = model.Product_Sale_From + "-" + model.Product_Sale_TO,
                     model.CGST,
                     model.SGST_UTGST,
                     model.IGST,
                     model.GstProductCat,
                     model.GstProductSubCat,
                     model.Description_Of_Goods,
                     model.IsActive,
                     model.Comments,
                     User = CurrentUser.UserId,
                     CurrentUser.CompanyId,
                     ACTION = "I"
                 }, commandType: CommandType.StoredProcedure).FirstOrDefault();
                 if (result == 1)
                 {
                     TempData["Message"] = "Successfully Added";
                 }
                 else
                 {
                     TempData["Message"] = "Sorry please try again";
                 }
             }
             return(RedirectToAction("SacCodes"));
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         throw;
     }
     return(RedirectToAction("SacCodes"));
 }
        public ActionResult AddSacCodes()
        {
            var           SessionModel = Session["User"] as SessionModel;
            SacCodesModel sm           = new SacCodesModel
            {
                CountryList           = new SelectList(dropdown.BindCountry(), "Value", "Text"),
                StateList             = new SelectList(Enumerable.Empty <SelectList>()),
                GstList               = new SelectList(dropdown.BindGst(null), "Value", "Text"),
                AplicationTaxTypeList = new SelectList(CommonModel.GetApplicationTax(), "Value", "Text"),
            };

            return(View(sm));
        }
        public ActionResult EditSacCode(SacCodesModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (var con = new SqlConnection(_connectionString))
                    {
                        var result = con.Query <int>("Add_Edit_Delete_SACCodes",
                                                     new
                        {
                            model.SacCodesId,
                            model.CountryId,
                            model.StateId,
                            model.Applicable_Tax,
                            model.GstCategoryId,
                            model.GstHeading,
                            model.Gst_HSN_Code,
                            model.CTH_Number,
                            model.SAC,
                            //model.Product_Sale_Range,
                            Product_Sale_Range = model.Product_Sale_From + "-" + model.Product_Sale_TO,
                            model.CGST,
                            model.SGST_UTGST,
                            model.IGST,
                            model.GstProductCat,
                            model.GstProductSubCat,
                            model.Description_Of_Goods,
                            model.IsActive,
                            model.Comments,
                            User = CurrentUser.UserId,
                            CurrentUser.CompanyId,
                            ACTION = "U"
                        }, commandType: CommandType.StoredProcedure).FirstOrDefault();
                        if (result == 2)
                        {
                            TempData["Message"] = "Updated Successfully";
                        }
                        else
                        {
                            TempData["Message"] = "Not Updated Successfully";
                        }
                    }


                    return(RedirectToAction("SacCodes"));
                }

                else
                {
                    model.CountryList = new SelectList(dropdown.BindCountry(), "Value", "Text");
                    model.StateList   = new SelectList(dropdown.BindState(model.CountryId), "Value", "Text");
                    model.GstList     = new SelectList(dropdown.BindGst(null), "Value", "Text");
                    return(View(model));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }