public async Task <ActionResult> EditPost(Student model, HttpPostedFileBase picture)
        {
            var userPicture = HandleUserPictureUpload(picture);

            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            try
            {
                await studentService.UpdateStudentAsync(model, userPicture);

                return(RedirectToAction(nameof(Details), new { model.ID }));
            }
            catch (RetryLimitExceededException /* dex */)
            {
                //Log the error (uncomment dex variable name and add a line here to write a log.
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator.");
            }

            return(View(model));
        }
        public async Task <IActionResult> EditPost(Student model, IFormFile picture)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var userPicture = await HandleUserPictureUpload(picture);

            try
            {
                await studentService.UpdateStudentAsync(model, userPicture);

                return(RedirectToAction(nameof(Details), new { model.ID }));
            }
            catch (DbUpdateException /* ex */)
            {
                //Log the error (uncomment ex variable name and write a log.)
                ModelState.AddModelError("", "Unable to save changes. " +
                                         "Try again, and if the problem persists, " +
                                         "see your system administrator.");
            }
            return(View(model));
        }