public ActionResult AddChat(int id, Bericht bericht) { Account account = (Account)Session["loggedIn_Account"]; Contact contact = new Contact { ContactAccountID = id }; bericht = new Bericht { ChatBericht = bericht.ChatBericht, OntvangerID = contact.ContactAccountID, VerstuurderID = account.ID, DatumTijd = DateTime.Now }; if (ModelState.IsValid) { chatRepository.AddChat(bericht); return RedirectToAction("Index", "Contact"); }else{ ModelState.AddModelError("error", "Er is iets misgegaan.."); } return View(bericht); }
public void VoegContactToe(Contact contact) { bool BestaandeAccount = ctx.Accounts.Any(c => c.Nummer == contact.Nummer); if (BestaandeAccount.Equals(contact)) { //??????? } ctx.Contacten.Add(contact); }
public ActionResult VerwijderContact(Contact contact) { if (ModelState.IsValid) { contactRepository.VerwijderContact(contact.ID); contactRepository.Opslaan(); } else { ModelState.AddModelError("error", "Er is iets misgegaan.."); } return RedirectToAction("Index", "Contact"); }
public ActionResult VoegContactToe(Contact contact) { Account account = (Account)Session["loggedIn_Account"]; contact = new Contact { Naam = contact.Naam, Nummer = contact.Nummer, OwnerAccountID = account.ID }; if (ModelState.IsValid) { contactRepository.VoegContactToe(contact); contactRepository.Opslaan(); return RedirectToAction("Index"); } else { ModelState.AddModelError("error", "Er is iets misgegaan"); } return View(contact); }
public void Update(Contact contact) { ctx.Entry(contact).State = EntityState.Modified; }
public ActionResult WijzigContact(Contact contact) { Account account = (Account)Session["loggedIn_Account"]; contact.Naam = contact.Naam; contact.Nummer = contact.Nummer; contact.OwnerAccountID = account.ID; if (ModelState.IsValid) { contactRepository.Update(contact); contactRepository.Opslaan(); return RedirectToAction("index"); } else { ModelState.AddModelError("error", "Er is iets misgegaan"); } return View(contact); }