Ejemplo n.º 1
0
        public ActionResult AddComment(int id)
        {
            //if (id == null)
            //{
            //    return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            //}

            tblComments comments = new tblComments();

            comments.tblTipsId = id;

            return View(comments);
        }
Ejemplo n.º 2
0
        public ActionResult AddComment(tblComments comment)
        {
            try
            {
                if(ModelState.IsValid)
                {
                    comment.created = DateTime.Now;

                    db.tblComments.Add(comment);
                    db.SaveChanges();
                    return RedirectToAction("Index");
                }
            }
            catch(RetryLimitExceededException)
            {
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");

            }

            return View(comment);
        }