public ActionResult DeleteConfirmed(long id)
        {
            PropertyOwnerRepresentative propertyownerrepresentative = db.PropertyOwnerRepresentatives.Find(id);

            db.PropertyOwnerRepresentatives.Remove(propertyownerrepresentative);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        //
        // GET: /PropertyOwnerRepresentative/Edit/5

        public ActionResult Edit(long id = 0)
        {
            PropertyOwnerRepresentative propertyownerrepresentative = db.PropertyOwnerRepresentatives.Find(id);

            if (propertyownerrepresentative == null)
            {
                return(HttpNotFound());
            }
            return(View(propertyownerrepresentative));
        }
        public ActionResult Create(PropertyOwnerRepresentative propertyownerrepresentative)
        {
            if (ModelState.IsValid)
            {
                db.PropertyOwnerRepresentatives.Add(propertyownerrepresentative);
                db.SaveChanges();
                return(RedirectToAction("Edit", new { id = propertyownerrepresentative.PropertyOwnerRepresentativeID }));
            }

            return(View(propertyownerrepresentative));
        }
 public ActionResult Edit(PropertyOwnerRepresentative propertyownerrepresentative)
 {
     if (ModelState.IsValid)
     {
         using (var _db = new PortugalVillasContext())
         {
             _db.PropertyOwnerRepresentatives.Attach(propertyownerrepresentative);
             _db.Entry(propertyownerrepresentative).State = EntityState.Modified;
             _db.SaveChanges();
             return(RedirectToAction("Edit", new { id = propertyownerrepresentative.PropertyOwnerRepresentativeID }));
         }
     }
     return(View(propertyownerrepresentative));
 }