public async Task <IActionResult> Create(CreatePlayerVM createPlayerVM)
        {
            if (ModelState.IsValid)
            {
                PlayerReqM playerReqM = mapper.Map <CreatePlayerVM, PlayerReqM>(createPlayerVM);

                (PlayerCreatedRespM playerCreatedRespM, ModelStateDictionary modelStateDictionary) = await playersServiceManager.CreateAsync(playerReqM, ModelState);

                if (modelStateDictionary.IsValid)
                {
                    return(RedirectToAction("Index"));
                }
            }

            return(View(ModelState));
        }
        public ActionResult Create(CreatePlayerVM playerInfo)
        {
            using (var session = sessionFactory.OpenSession())
            {
                string dir         = @"C:\Users\Vishnupriya\source\repos\TopSpin2.0\TopSpin2.0\images\";
                var    playerToAdd = new Player();

                if (ModelState.IsValid)
                {
                    playerToAdd.PlayerID   = playerInfo.Player.PlayerID;
                    playerToAdd.PlayerName = playerInfo.Player.PlayerName;
                    playerToAdd.Country    = playerInfo.Player.Country;
                    playerToAdd.Age        = playerInfo.Player.Age;
                    playerToAdd.Height     = playerInfo.Player.Height;

                    if (playerInfo.PhotoFile != null && playerInfo.PhotoFile.ContentLength > 0)
                    {
                        var fileName = Path.GetFileName(playerInfo.PhotoFile.FileName);
                        playerInfo.PhotoFile.SaveAs(Path.Combine(dir, fileName));
                    }
                    else
                    {
                        var fileName = "test.png";
                        playerInfo.PhotoFile.SaveAs(Path.Combine(dir, fileName));
                    }
                    playerToAdd.FilePath = Path.Combine(dir, playerInfo.PhotoFile.FileName);



                    session.Save(playerToAdd);
                    return(RedirectToAction("Index", "Player"));
                }

                return(View(playerInfo));
            }
        }