public ActionResult Create(messagesdbs messagesdbs) { if (ModelState.IsValid) { db.messagesdbs.Add(messagesdbs); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.author = new SelectList(db.utilisateursdbs, "ID", "firstname", messagesdbs.author); ViewBag.theme = new SelectList(db.themesdbs, "themeId", "name", messagesdbs.theme); return View(messagesdbs); }
public ActionResult Create(messagesdbs messagesdbs) { if (ModelState.IsValid) { db.messagesdbs.AddObject(messagesdbs); db.SaveChanges(); return RedirectToAction("Index"); } ViewData["author"] = new SelectList(db.my_aspnet_users, "ID", "firstname", messagesdbs.author); ViewData["theme"] = new SelectList(db.themesdbs, "themeId", "name", messagesdbs.theme); return View(messagesdbs); }
public ActionResult CreateANew(messagesdbs messagesdbs) { messagesdbs.author = 1; messagesdbs.censored = 0; messagesdbs.important = 0; messagesdbs.date = DateTime.Now; if (ModelState.IsValid) { db.messagesdbs.AddObject(messagesdbs); db.SaveChanges(); return RedirectToAction("NewsFeed"); } ViewData["author"] = new SelectList(db.my_aspnet_users, "ID", "firstname", messagesdbs.author); ViewData["theme"] = new SelectList(db.themesdbs, "themeId", "name", messagesdbs.theme); return View(messagesdbs); }
public ActionResult CreateANew(messagesdbs messagesdbs) { messagesdbs.author = 1; messagesdbs.censored = 0; messagesdbs.important = 0; messagesdbs.date = DateTime.Now; if (ModelState.IsValid) { db.messagesdbs.Add(messagesdbs); db.SaveChanges(); return RedirectToAction("NewsFeed"); } ViewBag.author = new SelectList(db.utilisateursdbs, "ID", "firstname", messagesdbs.author); ViewBag.theme = new SelectList(db.themesdbs, "themeId", "name", messagesdbs.theme); return View(messagesdbs); }
public ActionResult CreateThemedNew(messagesdbs messagesdbs) { my_aspnet_users user = db.my_aspnet_users.Where(a => a.name.Equals(User.Identity.Name)).FirstOrDefault(); messagesdbs.author = user.id; messagesdbs.censored = 0; messagesdbs.important = 0; messagesdbs.date = DateTime.UtcNow; try { db.messagesdbs.AddObject(messagesdbs); db.SaveChanges(); return RedirectToAction("NewsFeed"); } catch { return View(messagesdbs); } }
public ActionResult CreateThemedNew(int themeId) { messagesdbs messagesdbs = new messagesdbs(); messagesdbs.theme = themeId; return View(messagesdbs); }
public ActionResult Edit(messagesdbs messagesdbs) { if (ModelState.IsValid) { //db.Entry(messagesdbs).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewData["author"] = new SelectList(db.my_aspnet_users, "ID", "firstname", messagesdbs.author); ViewData["theme"] = new SelectList(db.themesdbs, "themeId", "name", messagesdbs.theme); return View(messagesdbs); }
public ActionResult Edit(messagesdbs messagesdbs) { if (ModelState.IsValid) { db.Entry(messagesdbs).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.author = new SelectList(db.utilisateursdbs, "ID", "firstname", messagesdbs.author); ViewBag.theme = new SelectList(db.themesdbs, "themeId", "name", messagesdbs.theme); return View(messagesdbs); }
/// <summary> /// Méthode déconseillée pour ajouter un nouvel objet à l'EntitySet messagesdbs. Utilisez la méthode .Add de la propriété ObjectSet<T> associée à la place. /// </summary> public void AddTomessagesdbs(messagesdbs messagesdbs) { base.AddObject("messagesdbs", messagesdbs); }
/// <summary> /// Créez un nouvel objet messagesdbs. /// </summary> /// <param name="messageID">Valeur initiale de la propriété messageID.</param> /// <param name="date">Valeur initiale de la propriété date.</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="censored">Valeur initiale de la propriété censored.</param> /// <param name="important">Valeur initiale de la propriété important.</param> public static messagesdbs Createmessagesdbs(global::System.Int32 messageID, global::System.DateTime date, global::System.Int32 author, global::System.String content, global::System.Int32 censored, global::System.Int32 important) { messagesdbs messagesdbs = new messagesdbs(); messagesdbs.messageID = messageID; messagesdbs.date = date; messagesdbs.author = author; messagesdbs.content = content; messagesdbs.censored = censored; messagesdbs.important = important; return messagesdbs; }