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");
 }
示例#2
0
 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();
 }