public ActionResult Insert(Models.Post objPost) { try { clsDataBaseMethodsPosts objDB = new clsDataBaseMethodsPosts(); if (objDB.ExistsTitle(objPost.strTitle)) { TempData["Error"] = "¡Post title already exists!"; return(RedirectToAction("Index", "Posts")); } objDB.Insert(objPost); TempData["Success"] = "¡Post Created!"; return(RedirectToAction("Index", "Posts")); } catch (Exception ex) { ViewBag.Error = ex.Message; } return(View(objPost)); }