public async Task <ActionResult> UploadMatrix(HttpPostedFileBase file) { if (file != null) { var matrix = await _matrixService.ToMatrixAsync(file.InputStream); try { await _matrixService.WriteMatrixAsync(matrix); } catch (ArgumentOutOfRangeException) { return(RedirectToAction("Index", "Home", new { Error = "Матрица не квадратная" })); } } return(RedirectToAction("Index", "Home")); }