public ActionResult DeleteComment(string CommentGuid) { shCommentService _comment = new shCommentService(); using (var context = new ShopOnlineDb()) { using (var dbContextTransaction = context.Database.BeginTransaction()) { try { if (!string.IsNullOrEmpty(CommentGuid) || !string.IsNullOrWhiteSpace(CommentGuid)) { shComment comment = _comment.FindByKey(CommentGuid); comment.Status = false; _comment.Update(comment); } dbContextTransaction.Commit(); } catch (Exception ex) { dbContextTransaction.Rollback(); } } } return(RedirectToAction("Index")); }
public ActionResult PostComment(string rating, string name, string email, string content, string productguid) { shCommentService _comment = new shCommentService(); shComment comment = _comment.Insert_UpdateComment( null, null, null, productguid, email, name, TypeHelper.ToInt32(rating), content, true, DateTime.Now); if (Request.IsAjaxRequest()) { return(Json("OK", JsonRequestBehavior.AllowGet)); } return(View()); }