public ActionResult AddSparePartsPriceandStock(SparePartsPriceStockModel model)
        {
            try
            {
                using (var con = new SqlConnection(_connectionString))
                {
                    var result = con.Query <int>("Add_Edit_SpareStock",
                                                 new
                    {
                        model.SparePriceStockId,
                        CategoryId = model.CatName,
                        SubCatId   = model.SubCatName,
                        BrandId    = model.Brand,
                        ModelName  = model.ProductName,
                        model.CTH_Number,
                        model.TRUPC,
                        model.TGFGPartCode,
                        SpareTypeId = model.SpareTypeName,
                        SpareNameID = model.PartName,
                        model.SpareCode,
                        model.EstimatedPrice,
                        model.MarketPrice,
                        model.SpareQty,
                        model.IsActive,
                        User   = "",
                        Action = "add"
                    }
                                                 , commandType: CommandType.StoredProcedure).FirstOrDefault();
                    if (result == 1)
                    {
                        TempData["AddPriceandStock"] = "Successfully Added";
                    }
                    else
                    {
                        TempData["AddPriceandStock"] = "Location Name Already Exist";
                    }
                }
            }
            catch (Exception e)
            {
                throw;
            }

            return(RedirectToAction("ManageSparePartsPriceandStock"));
        }
        public ActionResult AddSparePartsPriceandStock()
        {
            //using (var con = new SqlConnection(_connectionString))
            //{
            //    var result = con.Query<SparePartsPriceStockModel>("GetSparePriceData",
            //            new{ID=1}, commandType: CommandType.StoredProcedure).FirstOrDefault();


            //    return View(result);
            //}
            var sparepartspricestock = new SparePartsPriceStockModel();

            sparepartspricestock.CatNameList       = new SelectList(dropdown.BindCategory(CurrentUser.CompanyId), "Value", "Text");
            sparepartspricestock.SubCatNameList    = new SelectList(Enumerable.Empty <SelectListItem>());
            sparepartspricestock.BrandList         = new SelectList(dropdown.BindBrand(CurrentUser.CompanyId), "Value", "Text");
            sparepartspricestock.ProductNameList   = new SelectList(Enumerable.Empty <SelectListItem>());
            sparepartspricestock.PartNameList      = new SelectList(Enumerable.Empty <SelectListItem>());
            sparepartspricestock.SpareTypeNameList = new SelectList(dropdown.BindSpareType(CurrentUser.CompanyId), "Value", "Text");
            return(PartialView(sparepartspricestock));
        }