Exemple #1
0
        public IActionResult Update(Guid id)
        {
            try
            {
                var user = _userManager.GetUserAsync(User).Result;
                if (!_companyManager.IsUserCompanyAdmin(user.Id, id))
                {
                    return(NotFound());
                }

                var company = _companyManager.Get(id);
                if (company == null)
                {
                    return(NotFound());
                }

                var model = new OrganizationViewModel(company)
                {
                    Countries = _countryManager.GetCountries()
                                .Select(c => new SelectListItem
                    {
                        Text  = c.Name,
                        Value = c.IsoCountryCode
                    }).ToList()
                };

                return(View(nameof(Update), model));
            }
            catch (InvalidOperationException e)
            {
                _logger.LogError(e.Message, e);
                return(NotFound());
            }
        }
        public async Task <IActionResult> Profile()
        {
            var user = await _userManager.GetUserAsync(User);

            var model = new ProfileViewModel(user, _companyManager);

            return(View(model));
        }
Exemple #3
0
        public async Task <IActionResult> GeneratePlaylist(string from, string to, PlaylistConfigVM playlistConfig)
        {
            var user = await _userManagerWrapper.GetUserAsync(User);

            var dto         = _mapper.Map <PlaylistConfigDTO>(playlistConfig);
            var playlistDTO = await _playlistService.GeneratePlaylist(from, to, dto, user.Id);

            var playlistId = playlistDTO.Id;

            return(RedirectToAction("NowListening", new { id = playlistId }));
        }