public ActionResult Register(Speaker speaker) { if (ModelState.IsValid) { using (TechContext db = new TechContext()) { db.Speaker.Add(speaker); db.SaveChanges(); ModelState.Clear(); speaker = null; ViewBag.Message = "Successfully Registration Done"; TempData["Success"] = "Success message text."; return RedirectToAction("Index", "Home"); } } else return View(speaker); //return RedirectToAction("Index", "Home"); }
public ActionResult Register(Speaker speaker) { if (ModelState.IsValid) { using (TechContext db = new TechContext()) { db.Speaker.Add(speaker); db.SaveChanges(); ModelState.Clear(); speaker = null; ViewBag.Message = "Successfully Registration Done"; TempData["Success"] = "Success message text."; return(RedirectToAction("Index", "Home")); } } else { return(View(speaker)); } //return RedirectToAction("Index", "Home"); }
public virtual void Add(TEntity entity) { _dbset.Add(entity); _dbContext.SaveChanges(); }