public ActionResult Create([Bind(Include = "Id,Email,Forname,Surname")] promoter promoter) { /*if (ModelState.IsValid) * { * db.Promoters.Add(promoter); * db.SaveChanges(); * return RedirectToAction("Index"); * } * * return View(promoter);*/ try { ExpoesContext expo = new ExpoesContext(); var c = expo.Promoters.Single(p => p.Email == User.Identity.Name); UpdateModel(c); expo.SaveChanges(); HttpContext.GetOwinContext().Authentication.SignOut(DefaultAuthenticationTypes.ApplicationCookie); //await AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie); return(RedirectToAction("Login", "Account")); } catch (Exception exc) { return(View(promoter)); } }
public ActionResult DeleteConfirmed(long id) { promoter promoter = db.Promoters.Find(id); db.Promoters.Remove(promoter); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: promoters/Create public ActionResult Create(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } promoter promoter1 = db.Promoters.Find(id); if (promoter1 == null) { return(HttpNotFound()); } return(View(promoter1)); }
public ActionResult MyExpos(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } promoter p = db.Promoters.Find(id); if (p == null) { return(HttpNotFound()); } return(View(db.Expos.Where(pr => pr.Promoter == p.Id).ToList())); }
public ActionResult Edit([Bind(Include = "Id,Email,Forname,Surname")] promoter promoter) { try { ExpoesContext expo = new ExpoesContext(); var c = expo.Promoters.Single(p => p.Id == promoter.Id); UpdateModel(c); expo.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception exc) { return(View(promoter)); } }
public ActionResult AddExpo(long?id) { promoter p = db.Promoters.Find(id); return(RedirectToAction("Create", "Expoes", new { promoterid = p.Id })); }