public void Save(VoterPartyRelation obj)
 {
     if (obj.Id == 0)
         context.Entry(obj).State = System.Data.Entity.EntityState.Added;
     else
         context.Entry(obj).State = System.Data.Entity.EntityState.Modified;
     context.SaveChanges();
 }
Ejemplo n.º 2
0
 public ActionResult AddParty(VoterPartyRelation obj)
 {
     if(ModelState.IsValid)
     {
         dataManager.VoterPartyRelations.Save(obj);
         return RedirectToAction("Show", new { Id = obj.VoterId });
     }
     return View(obj);
 }