public ActionResult AddSolutionFile(SolutionToTask model)
 {
     studentTasksUpdate(HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier));
     if (ModelState.IsValid && model.PostedFile != null)
     {
         var allowedExtensions = new string[] { "doc", "docx", "pdf", "txt" };
         var extension         = Path.GetExtension(model.PostedFile.FileName).ToLower().Replace(".", "");
         if (allowedExtensions.Contains(extension))
         {
             Solution newSolution = new Solution();
             using (var ms = new MemoryStream())
             {
                 model.PostedFile.CopyTo(ms);
                 var fileBytes = ms.ToArray();
                 newSolution.File = fileBytes;
             }
             _Solution.GetById(_Task.GetById(model.TaskId).SolutionId).File = newSolution.File;
             _Solution.Update(_Solution.GetById(_Task.GetById(model.TaskId).SolutionId));
             newSolution.Task.Add(_Task.GetById(model.TaskId));
             return(View("SolvedTask", model));
         }
         else
         {
             ModelState.AddModelError(nameof(model.PostedFile), "Incorrect format");
             return(View(model));
         }
     }
     return(View("SolvedTask", model));
 }
        public ActionResult AddSolutionPage(int id)
        {
            studentTasksUpdate(HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier));
            bool           taskType = false;
            SolutionToTask model;

            foreach (var test in studentTasks.Tests)
            {
                if (test._Task.Id == id)
                {
                    taskType = true;
                }
            }
            if (taskType)
            {
                _FullTask current_test = studentTasks.Tests.Where(h => h._Task.Id == id).FirstOrDefault();
                model = new SolutionToTask(current_test.NameOfDiscipline, current_test.TaskAssignment.Requirenments, current_test.Time, current_test.Lector, id);
            }
            else
            {
                _FullTask current_hw = studentTasks.Hometasks.Where(h => h._Task.Id == id).FirstOrDefault();
                model = new SolutionToTask(current_hw.NameOfDiscipline, current_hw.TaskAssignment.Requirenments, current_hw.Time, current_hw.Lector, id);
            }
            return(View(model));
        }
        //ListHomework
        //ListSubjects
        //ListTestWork

        public IActionResult SolvedTask(SolutionToTask model)
        {
            studentTasksUpdate(HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier));
            double countedPercent = 0;

            model.Percent = countedPercent;
            return(View(model));
        }