Esempio n. 1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (ModelState.IsValid)
            {
//                var isAuthorized = await AuthorizationService.AuthorizeAsync(
//                   User, Prediction,
//                    PouleOperations.Update);
//                if (!isAuthorized.Succeeded)
//                    return new ChallengeResult();

                _predictionData.Update(_predictionConverter.ToEntity(Prediction, Context, Id));
                return(RedirectToAction("Details", "Predictions", new { id = Id }));
            }
            return(Page());
        }
Esempio n. 2
0
 public IActionResult OnPost()
 {
     // The trick here is that we always store the data in the database
     // as the user might want to get back to this page
     foreach (var prediction in Predictions)
     {
         if (prediction.HalftimeScore != null || prediction.FulltimeScore != null)
         {
             var p = _predictionConverter.ToEntity(prediction, Context);
             p.User = _userData.Get(MyUser.Id);
             p.Game = _gameData.Get(prediction.GameId);
             if (prediction.Id < 1)
             {
                 _predictionData.Add(p);
             }
             else
             {
                 _predictionData.Update(p);
             }
         }
     }
     return(RedirectToPage("MyPredictions"));
 }