public ActionResult Edit(AreaVendor areaVendor, int id)
 {
     if (ModelState.IsValid)
     {
         AreaCover areaCover = db.AreaCovers.Find(id);
         areaCover.AreaName        = areaVendor.AreaName;
         areaCover.PopularName     = areaVendor.PopularName;
         areaCover.AreaTitle       = areaVendor.Title;
         areaCover.AreaUrl         = areaVendor.YourUrl;
         db.Entry(areaCover).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(areaVendor));
 }
 public ActionResult Create(AreaVendor areaVendor)
 {
     if (ModelState.IsValid)
     {
         AreaCover areaCover = new AreaCover()
         {
             //VendorCompanyId =(int)System.Web.HttpContext.Current.Session["vendorBranchid"],
             //ViewBag.CompanyId = new SelectList(db.VendorCompanies, "VendorCompanyId", "Name"),
             VendorCompanyId = areaVendor.VendorCompanyId,
             AreaName        = areaVendor.AreaName,
             PopularName     = areaVendor.PopularName,
             AreaTitle       = areaVendor.Title,
             AreaUrl         = areaVendor.YourUrl
         };
         db.AreaCovers.Add(areaCover);
         db.SaveChanges();
         ViewBag.VendorCompanyId = new SelectList(db.VendorCompanies, "VendorCompanyId", "BranchName", areaCover.VendorCompanyId);
         return(RedirectToAction("Index"));
     }
     return(View(areaVendor));
 }