public ActionResult contactUs(contactU comments) { //contactU obj = new contactU(); // db.contactUs.Add(obj); //db.SaveChanges(); userRepo.saveComments(comments); return(RedirectToAction("Index")); }
public ActionResult CreateContactUs(contactU info) { if (info.Name == null || info.Email == null || info.Massage == null) { TempData["contactUsDone"] = "Fill up ALl Text Box"; return(RedirectToAction("CreateContactUs")); } context.contactUs.Add(info); context.SaveChanges(); TempData["contactUsDone"] = "Thanks for your Info"; return(RedirectToAction("CreateContactUs")); }
public IHttpActionResult AddContactQuery([FromBody] contactU newcontact) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.contactUs.Add(newcontact); db.SaveChanges(); } catch (Exception ex) { throw ex; } return(Ok(newcontact)); }