public ActionResult DeleteConfirmed(int groupId, int contactId)
        {
            AspNetGroupContact aspNetGroupContact = db.AspNetGroupContacts.Find(groupId, contactId);

            db.AspNetGroupContacts.Remove(aspNetGroupContact);
            db.SaveChanges();
            return(RedirectToAction("../Groups/Index"));
        }
 public ActionResult Edit([Bind(Include = "GroupId,ContactId")] AspNetGroupContact aspNetGroupContact)
 {
     if (ModelState.IsValid)
     {
         db.Entry(aspNetGroupContact).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(aspNetGroupContact));
 }
        // GET: GroupContacts/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AspNetGroupContact aspNetGroupContact = db.AspNetGroupContacts.Find(id);

            if (aspNetGroupContact == null)
            {
                return(HttpNotFound());
            }
            return(View(aspNetGroupContact));
        }
        // GET: GroupContacts/Delete/5
        public ActionResult Delete(int?groupId, int contactId)
        {
            if (groupId == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AspNetGroupContact aspNetGroupContact = db.AspNetGroupContacts.Find(groupId, contactId);

            if (aspNetGroupContact == null)
            {
                return(HttpNotFound());
            }
            return(View(aspNetGroupContact));
        }
        public ActionResult Create(int groupId, int[] contactIds)
        {
            if (ModelState.IsValid)
            {
                for (int i = 0; i < contactIds.Length; i++)
                {
                    AspNetGroupContact item = new AspNetGroupContact(groupId, contactIds[i]);
                    db.AspNetGroupContacts.AddOrUpdate(item);
                }

                db.SaveChanges();
                return(RedirectToAction("../Groups/Index"));
            }

            return(View());
        }