Пример #1
0
        public ActionResult CreateAComment(commentsdbs commentsdbs)
        {
            commentsdbs.author = 1;
            commentsdbs.date = DateTime.Now;

            if (ModelState.IsValid)
            {
                db.commentsdbs.Add(commentsdbs);
                db.SaveChanges();
                return RedirectToAction("../Messages/NewsFeed");
            }
            return View(commentsdbs);
        }
Пример #2
0
        public ActionResult Create(commentsdbs commentsdbs)
        {
            if (ModelState.IsValid)
            {
                db.commentsdbs.Add(commentsdbs);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.messageId = new SelectList(db.messagesdbs, "messageID", "content", commentsdbs.messageId);
            ViewBag.author = new SelectList(db.utilisateursdbs, "ID", "firstname", commentsdbs.author);
            return View(commentsdbs);
        }
Пример #3
0
        public ActionResult CreateAComment(commentsdbs commentsdbs)
        {
            my_aspnet_users user = db.my_aspnet_users.Where(a => a.name.Equals(User.Identity.Name)).FirstOrDefault();
            commentsdbs.author = user.id;
            commentsdbs.date = DateTime.Now;

            try
            {
                db.commentsdbs.AddObject(commentsdbs);
                db.SaveChanges();

                return RedirectToAction("NewsFeed", "Messages");
            }
            catch
            {
                return View(commentsdbs);
            }
        }
Пример #4
0
 //
 // GET: /Comments/CreateAComment
 public ActionResult CreateAComment(int id)
 {
     commentsdbs commentsdbs = new commentsdbs();
     commentsdbs.messageId = id;
     return View(commentsdbs);
 }
Пример #5
0
 /// <summary>
 /// Créez un nouvel objet commentsdbs.
 /// </summary>
 /// <param name="id">Valeur initiale de la propriété ID.</param>
 /// <param name="messageId">Valeur initiale de la propriété messageId.</param>
 /// <param name="author">Valeur initiale de la propriété author.</param>
 /// <param name="content">Valeur initiale de la propriété content.</param>
 /// <param name="date">Valeur initiale de la propriété date.</param>
 public static commentsdbs Createcommentsdbs(global::System.Int32 id, global::System.Int32 messageId, global::System.Int32 author, global::System.String content, global::System.DateTime date)
 {
     commentsdbs commentsdbs = new commentsdbs();
     commentsdbs.ID = id;
     commentsdbs.messageId = messageId;
     commentsdbs.author = author;
     commentsdbs.content = content;
     commentsdbs.date = date;
     return commentsdbs;
 }
Пример #6
0
 /// <summary>
 /// Méthode déconseillée pour ajouter un nouvel objet à l'EntitySet commentsdbs. Utilisez la méthode .Add de la propriété ObjectSet&lt;T&gt; associée à la place.
 /// </summary>
 public void AddTocommentsdbs(commentsdbs commentsdbs)
 {
     base.AddObject("commentsdbs", commentsdbs);
 }