public virtual ActionResult SetBioSend(SetBioViewModel input) { var myMembershipId = User.Identity.GetUserId(); if (input.Text == null) { input.Text = ""; } if (input.Tags == null) { input.Tags = ""; } var me = PlayerProcedures.GetPlayerFromMembership(myMembershipId); if (input.Text.Length > 2500 && !me.DonatorGetsMessagesRewards()) { TempData["Error"] = "The text of your bio is too long (more than 2,500 characters)."; return(RedirectToAction(MVC.PvP.Play())); } if (input.Text.Length > 10000 && me.DonatorGetsMessagesRewards()) { TempData["Error"] = "The text of your bio is too long (more than 10,000 characters)."; return(RedirectToAction(MVC.PvP.Play())); } if (input.WebsiteURL == null) { input.WebsiteURL = ""; } if (input.Tags.Length > 1000) { TempData["Error"] = "Too many RP tags input text."; return(RedirectToAction(MVC.PvP.Play())); } if (input.WebsiteURL.Length > 1500) { TempData["Error"] = "The text of your website URL is too long (more than 1,500 characters)."; return(RedirectToAction(MVC.PvP.Play())); } SettingsProcedures.SavePlayerBio(input, myMembershipId); TempData["Result"] = "Your bio has been saved."; return(RedirectToAction(MVC.PvP.Play())); }
public static void SavePlayerBio(SetBioViewModel bio, string membershipId) { IPlayerBioRepository playerBioRepo = new EFPlayerBioRepository(); var playerBio = playerBioRepo.PlayerBios.FirstOrDefault(p => p.OwnerMembershipId == membershipId); if (playerBio == null) { playerBio = new PlayerBio { OwnerMembershipId = membershipId, }; } playerBio.Timestamp = DateTime.UtcNow; playerBio.Text = bio.Text; playerBio.WebsiteURL = bio.WebsiteURL; playerBio.Tags = bio.Tags; playerBioRepo.SavePlayerBio(playerBio); }