Ejemplo n.º 1
0
 public ActionResult Create(NewsItem newsitem)
 {
     //Set author to person logged in
     newsitem.Author = db.GetUserFromMember(Membership.GetUser()).DisplayName;
     newsitem.AuthorID = db.GetUserFromMember(Membership.GetUser()).Id;
     db.NewsItems.Add(newsitem);
     db.SaveChanges();
     return RedirectToAction("Index");
 }
Ejemplo n.º 2
0
 public ActionResult Edit(NewsItem newsitem)
 {
     if (ModelState.IsValid)
     {
         db.Entry(newsitem).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(newsitem);
 }