Пример #1
0
        public void SaveAvis(string commentaire, string nom, string idFormation, string note)
        {
            int iIdFormation = -1;

            if (!Int32.TryParse(idFormation, out iIdFormation))
            {
                return;
            }
            double dNote = -1;

            if (!Double.TryParse(note, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out dNote))
            {
                return;
            }

            var avis = new Avis();

            avis.Commentaire    = commentaire;
            avis.NomUtilisateur = nom;
            avis.FormationId    = iIdFormation;
            avis.Note           = dNote;

            _context.Avis.Add(avis);
            _context.SaveChanges();
        }
Пример #2
0
        public void SaveMessage(string nom, string email, string message)
        {
            var msg = new ContactMessage();

            msg.Email   = email;
            msg.nom     = nom;
            msg.Message = message;

            _context.Messages.Add(msg);
            _context.SaveChanges();
        }