コード例 #1
0
        public void AddSuggestie(string beschrijving, string genre, Client client)
        {
            var s = new Suggestie()
            {
                Beschrijving = beschrijving,
                Genre = genre,
                Client = client,
                TimeStamp = DateTime.Now
            };
            Suggesties.Add(s);

        }
コード例 #2
0
 public Klacht(string omschrijving, Client client)
 {
     Omschrijving = omschrijving;
     Client = client;
     TimeStamp = DateTime.Now;
 }
コード例 #3
0
        public ActionResult CreateClient(GebruikerViewModel.CreateClientViewModel model)
        {
            if (UserStillLoggedIn() || _gebruikerRepository.FindById((int)Session["gebruiker"]) is Client)
            {
                return ReturnToLogin();
            }

            if (ModelState.IsValid)
            {
                try
                {
                    if (model.GeselecteerdOpvangtehuisId != null)
                    {

                        if (_gebruikerRepository.FindByUsername(model.GebruikersNaam) != null)
                        {
                            this.AddNotification("Er is al reeds iemand met deze gebruikersnaam", NotificationType.ERROR);
                            return RedirectToAction("CreateClient");
                        }

                        //var crypto = new SimpleCrypto.PBKDF2();
                        //var encrytwachtwoord = crypto.Compute(model.Wachtwoord);

                        string pass = BCrypt.Net.BCrypt.HashPassword(model.Wachtwoord, BCrypt.Net.BCrypt.GenerateSalt());

                        var client = new Client(model.Naam, model.Voornaam,
                            _opvangtehuisRepository.FindByName(model.GeselecteerdOpvangtehuisId), model.GebruikersNaam,
                             pass);

                        _gebruikerRepository.AddClient(client);
                        _gebruikerRepository.SaveChanges();

                        if (_gebruikerRepository.FindById((int)Session["gebruiker"]) is Admin)
                        {
                            this.AddNotification("Cliënt toegevoegd", NotificationType.SUCCESS);
                            return RedirectToAction("AdminIndex");
                        }

                        this.AddNotification("Cliënt toegevoegd", NotificationType.SUCCESS);
                        return RedirectToAction("OpvoederIndex");

                    }
                }
                catch (ApplicationException e)
                {
                    ModelState.AddModelError("", e.Message);
                }
            }

            var ccvm = new GebruikerViewModel.CreateClientViewModel()
            {
                GebruikerType = _gebruikerRepository.FindById((int)Session["gebruiker"]).GetType().Name,
                Opvangtehuizen = _opvangtehuisRepository.FindAll().Select(oh => oh.Naam).ToList()
            };

            return View(ccvm);
        }
コード例 #4
0
        public Forum GetForum(Opvoeder opvoeder, Client client)
        {
            if (client == null || opvoeder == null)
            {
                return null;
            }

            if (!IsForumAlGemaakt(client.Id, opvoeder.Id))
            {
                var forum = new Forum(opvoeder, client);
                Forums.Add(forum);
                opvoeder.AddForum(forum);
                return forum;
            }
            return Forums.FirstOrDefault(f => f.Client == client && f.Opvoeder == opvoeder);
        }
コード例 #5
0
 public void UpdateClient(Client client)
 {
     _context.Entry(client).State = EntityState.Modified;
 }
コード例 #6
0
 public void AddClient(Client client)
 {
     _context.GebruikerSet.Add(client);
 }
コード例 #7
0
 public void AddKlacht(string omschrijving, Client client)
 {
     var klacht = new Klacht(omschrijving, client);
     Klachten.Add(klacht);
 }
コード例 #8
0
 public Forum(Opvoeder opvoeder, Client client)
 {
     Opvoeder = opvoeder;
     Client = client;
     Posts = new List<Post>();
 }