public ActionResult Create(Comments comments, int itemID, string commentType) { comments.author = db.GetUserFromMember(Membership.GetUser()).DisplayName; comments.AuthorID = db.GetUserFromMember(Membership.GetUser()).Id; comments.date = DateTime.Today.ToShortDateString(); comments.time = DateTime.Now.ToLongTimeString(); comments.commentType = commentType; comments.itemID = itemID; db.comments.Add(comments); db.SaveChanges(); if (commentType.Equals("Gallery")) { return RedirectToAction("AlbumDetail", commentType, new { id = itemID }); //As gallery uses AlbumDetail instead of Details } return RedirectToAction("Details", commentType, new { id = itemID }); }
public ActionResult Edit(Comments comments) { if (ModelState.IsValid) { db.Entry(comments).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(comments); }