public ActionResult Register(RegisterPlayerViewModel model) { var cookie = PlayerService.CreatePlayerCookie(model.Name, model.Avatar); Response.Cookies.Add(cookie); return(RedirectToAction("Index", "Game")); }
public ActionResult Register() { var model = new RegisterPlayerViewModel(); model.AvatarList = Directory.GetFiles(Server.MapPath("~/Content/img/avatars")) .Select(Path.GetFileName) .ToList(); return(View(model)); }
public ActionResult Register(RegisterPlayerViewModel pvm) { ServicePointManager.ServerCertificateValidationCallback = (obj, certificate, chain, errors) => true; using (var authServ = ServiceHelper.GetAuthServiceClient()) { try { var newPlayer = new ConquestionGame.Presentation.WebClient.AuthenticationServiceReference.Player { Name = pvm.Username }; authServ.RegisterPlayer(newPlayer, pvm.Email, pvm.Password); ViewBag.StatusMessage = String.Format("Successfully registered {0}", pvm.Username); } catch (Exception e) { ViewBag.StatusMessage = e.Message; } } return(View("Register")); }