public ActionResult Sign(GuestBookViewModel model, bool captchaValid) { ViewData["Selected"] = "ContactUs"; if (ModelState.IsValid) { if (captchaValid) { //BIND GuestBookViewModel to DataObject //NEED TO IMPLEMENT PROPER ORM IN FUTURE! GuestBookContact contact = new GuestBookContact(); contact.Contact_Email = model.Contact_Email; contact.Contact_Name = model.Contact_Name; contact.Comment = model.Comment; if (_gbServices.Post(contact)) { return(RedirectToAction("Index")); } else { ViewData["ErrorMessage"] = "An error occured while posting your comment. Please try again."; return(View()); } } else { ViewData["ErrorMessage"] = "You did not type the verification word correctly. Please try again."; return(View()); } } else { return(View()); } }
public Boolean Post(GuestBookContact guestbookcontact) { Boolean flag = false; using (IDbConnection con = DBUtils.SetConnection()) { IDbCommand command = DBUtils.database.CreateStoreProcCommand("CALL McKiverRacing_GuestbookPost(?,?,?);", con); command = DBUtils.database.AddCommandParameters("_name", guestbookcontact.Contact_Name, command); command = DBUtils.database.AddCommandParameters("_email", guestbookcontact.Contact_Email, command); command = DBUtils.database.AddCommandParameters("_comment", guestbookcontact.Comment, command); int ret = command.ExecuteNonQuery(); if (ret == 1) { flag = true; } return(flag); } }
public Boolean Post(GuestBookContact guestbookcontact) { return(_gbRepo.Post(guestbookcontact)); }