public ActionResult CreateProfile()
 {
     var profile = ProfileHelper.GetPlayerProfile(ProfileHelper.GetIdentity);
     if (profile == null)
         profile = new Player { DisplayName = string.Empty };
     return PartialView(profile);
 }
        public ActionResult EditProfile()
        {
            if (!ProfileHelper.UserHasProfile(ProfileHelper.GetIdentity))
            {
                return RedirectToAction("CreateProfile", "Player");
            }

            var profile = ProfileHelper.GetPlayerProfile(ProfileHelper.GetIdentity);
            if (profile == null)
                profile = new Player { DisplayName = string.Empty };
            return PartialView(profile);
        }
 public static void UpdateProfile(Guid id, string displayName, string avatar,string user)
 {
     if (id == Guid.Empty)
     {
         //create a new record
         var p = new Player { Id = Guid.NewGuid(), Avatar = avatar, DisplayName = displayName, IsOnline = true, LastActivity = DateTime.Now, Status = PlayerStatus.OnLine,  LiveId = user };
         CloudWarsDB.Players.Insert(p);
     }
     else
     {
         CloudWarsDB.Players.UpdateWithWhere(new { DisplayName = displayName, Avatar = avatar }, new { LiveId = user });
     }
 }
 public static void UpdatePlayer(Player player)
 {
     CloudWarsDB.Players.Update(player);
 }