public ActionResult ItemEdit(STPServiceProductItem item)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.Entry(item).State = EntityState.Modified;
                    db.SaveChanges();

                    TempData["Message"] = "Edited";
                }
            }
            catch (Exception ex)
            {
                TempData["Message"] = "NotEdited";
            }
            return(Redirect(Url.Action("ViewItems", "VendorDashboard")));
        }
        public ActionResult CreateItems(STPServiceProductItemMetadata obj)
        {
            string serviceType   = Session["serviceType"].ToString();
            var    productTypeID = (from d in db.STPProductTypes
                                    where (d.ProductTypeName == serviceType)
                                    select d.ID).FirstOrDefault();


            if (serviceType != null)
            {
                try {
                    STPServiceProductItem product = new STPServiceProductItem()
                    {
                        ServiceModelNo            = obj.ServiceModelNo,
                        ServiceProductName        = obj.ServiceProductName,
                        ServiceProductDescription = obj.ServiceProductDescription,
                        STPProductBrandID         = obj.STPProductBrandID,
                        IsAvailible      = true,
                        FuelTypeId       = obj.FuelTypeId,
                        UnitTypeId       = obj.UnitTypeId,
                        CostPrice        = obj.CostPrice,
                        SellingPrice     = obj.SellingPrice,
                        CreatedDateTime  = System.DateTime.Now,
                        STPProductTypeID = productTypeID
                    };
                    db.STPServiceProductItems.Add(product);
                    db.SaveChanges();
                    TempData["Message"] = "AddItem";
                }
                catch (Exception ex)
                {
                    TempData["Message"] = "NotAddItem";
                }
            }


            //else
            //{
            //    ViewBag.Message = "You have not specified a file.";
            //}

            return(Redirect(Url.Action("ViewItems", "VendorDashboard")));
        }