BusinessLogic.Logic.Players.PlayerSaver.UpdatePlayer C# (CSharp) Метод

UpdatePlayer() публичный Метод

public UpdatePlayer ( UpdatePlayerRequest updatePlayerRequest, ApplicationUser applicationUser ) : void
updatePlayerRequest BusinessLogic.Models.Players.UpdatePlayerRequest
applicationUser ApplicationUser
Результат void
        public virtual void UpdatePlayer(UpdatePlayerRequest updatePlayerRequest, ApplicationUser applicationUser)
        {
            var player = _dataContext.FindById<Player>(updatePlayerRequest.PlayerId);

            var somethingChanged = false;

            if (updatePlayerRequest.Active.HasValue)
            {
                player.Active = updatePlayerRequest.Active.Value;

                somethingChanged = true;
            }

            if (!string.IsNullOrWhiteSpace(updatePlayerRequest.Name))
            {
                player.Name = updatePlayerRequest.Name.Trim();

                somethingChanged = true;
            }

            if (somethingChanged)
            {
                Save(player, applicationUser);
            }
        }