MapRegistrationModel GetMapRegistrationModel(MapRegistrationModel model = null) { model = model ?? new MapRegistrationModel(); model.Cities = mapFeed.Maps .Where(t => t.NeedsRegistration) .OrderBy(t => t.City) .Select(t => new SelectListItem { Text = t.City, Value = t.City, }); return(model); }
public async Task <IActionResult> Register(MapRegistrationModel model) { const string AccountsFilePath = "Accounts.txt"; if (!ModelState.IsValid) { model = GetMapRegistrationModel(model); return(View("Register", model)); } logger.LogInformation($"Map registration: {model.City}, {model.Username}, ****, {model.DiscordUsername} [{Request.HttpContext.Connection.RemoteIpAddress}]"); using (var sw = new StreamWriter(AccountsFilePath, true)) await sw.WriteLineAsync($"{model.City},{model.Username},{model.Password},{model.DiscordUsername}"); return(View("RegistrationFinished")); }