public ActionResult Edit([Bind(Include = "SignupID,PlayerID,EventID,IsApproved,CommentGM,CommentPlayer")] PlayerSignup playerSignup)
        {
            if (ModelState.IsValid)
            {
                db.Entry(playerSignup).State = EntityState.Modified;
                db.SaveChanges();
                var evt = db.Events.Find(playerSignup.EventID);
                if (evt.HostID != User.Identity.GetUserId())
                {
                    var    subject  = $"Alert for {evt.Location} sign up";
                    string Username = db.GMs.Find(User.Identity.GetUserId()).Username;
                    string decision; if (playerSignup.IsApproved)
                    {
                        decision = "Approved";
                    }
                    else
                    {
                        decision = "Declined";
                    }

                    var messageBody = $"{Username} {decision} your application : \n {playerSignup.CommentGM}";
                    var player      = db.Players.Find(playerSignup.PlayerID);
                    MessageSender.SendEmail(subject, messageBody, player.Email);
                }
                return(RedirectToAction("Details", "Events", new { id = playerSignup.EventID }));
            }
            ViewBag.EventID  = new SelectList(db.Events, "EventID", "HostID", playerSignup.EventID);
            ViewBag.PlayerID = new SelectList(db.Players, "PlayerID", "Username", playerSignup.PlayerID);
            return(View(playerSignup));
        }
 public ActionResult Edit([Bind(Include = "PlayerID,Username,FirstName,LastName,Email,PreferredMedium,Bio,PreferredType,AvatarFilename")] Player player)
 {
     if (ModelState.IsValid)
     {
         db.Entry(player).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(player));
 }
Ejemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "EventID,HostID,Location,StartDate,EndDate,Duration,EventTime,MinimumPlayerCount,MaxPlayerCount,GameType")] Event @event)
 {
     if (ModelState.IsValid)
     {
         db.Entry(@event).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.HostID = new SelectList(db.GMs, "GMID", "Username", @event.HostID);
     return(View(@event));
 }
Ejemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "EventCommentID,EventID,PlayerID,Comment,CommentTime")] EventComment eventComment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(eventComment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.EventID  = new SelectList(db.Events, "EventID", "HostID", eventComment.EventID);
     ViewBag.PlayerID = new SelectList(db.Players, "PlayerID", "Username", eventComment.PlayerID);
     return(View(eventComment));
 }
 public ActionResult Edit([Bind(Include = "RatingID,PlayerID,GMID,Comment,Rating,RatingTime")] PlayerRating playerRating)
 {
     if (ModelState.IsValid)
     {
         db.Entry(playerRating).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.GMID     = new SelectList(db.GMs, "GMID", "Username", playerRating.GMID);
     ViewBag.PlayerID = new SelectList(db.Players, "PlayerID", "Username", playerRating.PlayerID);
     return(View(playerRating));
 }