Ejemplo n.º 1
0
        public async Task <IActionResult> AddSnapshot(Portfolio newPortfolio)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Index"));
            }

            var currentUser = await _userManager.GetUserAsync(User);

            if (currentUser == null)
            {
                return(Challenge());
            }

            var successful = await _portfolioService.AddSnapshotAsync(newPortfolio, currentUser);

            if (!successful)
            {
                return(BadRequest("Could not add item."));
            }

            return(RedirectToAction("Index"));
        }