示例#1
0
 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));
     }
 }
示例#2
0
        public ActionResult DeleteConfirmed(long id)
        {
            promoter promoter = db.Promoters.Find(id);

            db.Promoters.Remove(promoter);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#3
0
        // 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));
        }
示例#4
0
        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()));
        }
示例#5
0
 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));
     }
 }
示例#6
0
        public ActionResult AddExpo(long?id)
        {
            promoter p = db.Promoters.Find(id);

            return(RedirectToAction("Create", "Expoes", new { promoterid = p.Id }));
        }