public ActionResult ContactUs(tbl_ContactUs tContact) { Rep_ContactUs RepContactUs = new Rep_ContactUs(); if (ModelState.IsValid) { if (RepContactUs.Insert(tContact)) { ViewBag.Style = "color:green"; ViewBag.Message = "درخواست با موفقیت ثبت شد"; } else { ViewBag.Style = "color:red"; ViewBag.Message = "متاسفانه درخواست با موفقیت ثبت نشد"; } } else { ViewBag.Style = "color:red"; ViewBag.Message = "تمامی فیلدها را به صورت صحیح پر نمایید"; } return(View()); }
public void Delete(int id) //Delete single records { tbl_ContactUs user = db.tbl_ContactUs.Find(id); db.tbl_ContactUs.Remove(user); save(); }
public ActionResult Index(tbl_ContactUs contactus) { //Save record into table contactus.IsActive = true; contactus.CreatedDate = DateTime.Now; contactus.ModifiedDate = DateTime.Now; _dataContext.tbl_ContactUs.Add(contactus); _dataContext.SaveChanges(); return(RedirectToRoute("ThankYou")); //Send email to the user }
public bool Insert(tbl_ContactUs tContact) { try { db.tbl_ContactUs.Add(tContact); if (Convert.ToBoolean(db.SaveChanges() > 0)) { return(true); } else { return(false); } } catch { return(false); } }
public ActionResult Contact(tbl_ContactUs obj) { try { if (ModelState.IsValid) { ContactUsDB_Obj.Insert(obj); TempData["SENT"] = "Your Message Sent SuccessFully"; } } catch (Exception e) { TempData["SENT"] = "Your Message Sent SuccessFully" + e.Message; } return(View()); }
public void Insert(tbl_ContactUs obj) //Insert single records { db.tbl_ContactUs.Add(obj); save(); }