public ActionResult Create(PropertyRegion propertyregion)
        {
            if (ModelState.IsValid)
            {
                db.PropertyRegions.Add(propertyregion);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(propertyregion);
        }
        public ActionResult Edit(PropertyRegion propertyregion)
        {
            if (ModelState.IsValid)
            {
                using (var _db = new PortugalVillasContext())
                {
                    _db.PropertyRegions.Attach(propertyregion);
                    _db.Entry(propertyregion).State = EntityState.Modified;
                    _db.SaveChanges();
                    return RedirectToAction("Edit", new { id = propertyregion.PropertyRegionID });    
                }

                
            }
            return View(propertyregion);
        }
 public ActionResult Edit(PropertyRegion propertyregion)
 {
     if (ModelState.IsValid)
     {
         db.Entry(propertyregion).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(propertyregion);
 }