public ActionResult PlayerRegistration(PlayerRegistrationModel model) { if (ModelState.IsValid) { int recordsCreated = CreatePlayer(model.playerName, model.userName, model.playerBirthdate, model.playerTeam, model.playerEarnings, model.system, model.timeZone, model.mmr); MessageBox.Show("You have successfully registered your account"); return(RedirectToAction("Liquipedia", "Home")); } return(View()); }
public ActionResult Register([FromBody] PlayerRegistrationModel playerRegistrationModel) { try { Player player = new Player { Name = playerRegistrationModel.Name }; Game.Register(player); return(Json(player.Id)); } catch (Exception ex) { return(StatusCode(500, ex)); } }
public static int CreatePlayer(string PlayerName, string UserName, string PlayerBirthDate, string PlayerTeam, decimal PlayerEarnings, string System, string TimeZone, int Mmr) { PlayerRegistrationModel data = new PlayerRegistrationModel { playerName = PlayerName, userName = UserName, playerBirthDate = PlayerBirthDate, playerTeam = PlayerTeam, playerEarnings = PlayerEarnings, system = System, timeZone = TimeZone, mmr = Mmr }; string sql = @"insert into dbo.Player (playerName, userName, playerBirthdate, playerTeam, playerEarnings, system, timeZone, mmr) values (@playerName, @userName, @playerBirthdate, @playerTeam, @playerEarnings, @system, @timeZone, @mmr)"; return(SQLDataAccess.SaveData(sql, data)); }
public ActionResult PlayerRegistration(PlayerRegistrationModel emailModel) { if (!ModelState.IsValid) { return(View()); } else { try { string name = emailModel.FirstName + ' ' + emailModel.LastName; //Setup MailMessage using (MailMessage msg = new MailMessage()) { msg.From = new MailAddress(emailModel.Email, name); msg.ReplyToList.Add(msg.From); msg.CC.Add(msg.From); msg.To.Add(new MailAddress("*****@*****.**", "KSU Lacrosse")); msg.Subject = emailModel.Subject; string body = "Name: " + name + "\n" + "Email: " + emailModel.Email + "\n" + "Phone: " + emailModel.PhoneNumber + "\n" + "Position: " + emailModel.Position + "\n" + "USLaxID: " + emailModel.USLaxID + "\n" + "KSUID: " + emailModel.KSUID + "\n" + "Major: " + emailModel.Major + "\n" + "GPA: " + emailModel.GPA + "\n" + "Height: " + emailModel.Height + "\n" + "Weight: " + emailModel.Weight + "\n" + "Hometown: " + emailModel.Hometown + "\n" + "Homestate: " + emailModel.Homestate + "\n" + "Highschool: " + emailModel.Highschool + "\n" + "Highschoolyear: " + emailModel.Highschoolyear; msg.Body = body; msg.IsBodyHtml = false; //Send the Email using (SmtpClient client = smtpClient()) { client.Send(msg); } } MessageModel rcpt = new MessageModel(); rcpt.Title = "Thanks " + name + "!"; rcpt.Content = "Your registration has been submitted to the team. A copy has been emailed to you as well. Win it to be in it!"; return(View("Message", rcpt)); } catch (Exception e) { //Log in ELMAH logELMAH(e); //Show an error return(View("Message", errorMessage())); } } }