Exemple #1
0
        public async Task <IActionResult> LoadScores(DateModel dm)
        {
            if (dm.ForId == Guid.Empty)
            {
                return(RedirectToAction(
                           actionName: "LoadScores",
                           controllerName: "Students"
                           ));
            }
            var id = HttpContext.User.Claims
                     .FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value;
            var idGuid = Guid.Parse(id);

            var result = await _repo.LoadScores(idGuid, dm.ForId, dm.StartDate, dm.FinishDate);

            if (result.IsSuccess)
            {
                ViewBag.Scores  = result.Content;
                ViewBag.Message = result.Message;
                return(View("Scores"));
            }

            return(RedirectToAction(
                       actionName: "LoadScores",
                       controllerName: "Students",
                       routeValues: new { error = result.Message }
                       ));
        }