Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public void VoegContactToe(Contact contact)
        {
            bool BestaandeAccount = ctx.Accounts.Any(c => c.Nummer == contact.Nummer);

            if (BestaandeAccount.Equals(contact))
            {
               //???????
            }
            ctx.Contacten.Add(contact);
        }
Esempio n. 3
0
        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");
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
 public void Update(Contact contact)
 {
     ctx.Entry(contact).State = EntityState.Modified;
 }
Esempio n. 6
0
        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);
        }