Exemplo n.º 1
0
        public IActionResult UpdateGym(GymProfileViewModel model)
        {
            Gym gym = new Gym
            {
                Name    = model.Name,
                Address = model.Address,
                City    = model.City,
                Country = model.Country,
                Phone   = model.Phone,
                Email   = model.Email
            };

            _gymRepository.UpdateGym(gym, this.User.FindFirst(ClaimTypes.NameIdentifier).Value);

            return(RedirectToAction("GymProfile", "Manage"));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> GymProfile()
        {
            var user = await _userManager.GetUserAsync(User);

            GymProfileViewModel gymProfile = null;

            if (user.GymId != null)
            {
                Gym gym = _gymRepository.GetGymById((int)user.GymId);
                gymProfile = new GymProfileViewModel
                {
                    Name    = gym.Name,
                    Address = gym.Address,
                    City    = gym.City,
                    Country = gym.Country,
                    Phone   = gym.Phone,
                    Email   = gym.Email
                };
            }

            return(View(gymProfile));
        }