public ActionResult Product(DB.Comments comment) { try { comment.Member_Id = base.CurrentUserId(); comment.AddedDate = DateTime.Now; context.Comments.Add(comment); context.SaveChanges(); } catch (Exception ex) { ViewBag.MyError = ex.Message; } return(RedirectToAction("Product", "i")); }
public ActionResult Product(DB.Comments comments) { string message = string.Empty; try { comments.Member_Id = base.CurrentUserId(); comments.AddedDate = DateTime.Now; db.Comments.Add(comments); db.SaveChanges(); } catch (Exception ex) { message = ex.Message; } ViewBag.myError = message; return(RedirectToAction("Product", "Home")); }