public ActionResult Input(Graph i) { if (!i.IsValid) return View("Index", i); var arrays = new Arrays {Matrix = ConvertListToMatrix(i.Array)}; arrays.Id = arrays.GetHashCode(); _arrayRepository.Add(arrays); return View("Index", i); }
public ActionResult InputFile(Graph i) { var file = Request.Files["inputFile"]; if (file == null) return null; using (var reader = new StreamReader(file.InputStream)) { var dataFromFile = reader.ReadToEnd(); var str = dataFromFile; var strs = str.Split(' '); var size = (int) Math.Sqrt(strs.Length); var array = new double[size, size]; for (var k = 0; k < size; k++) { for (var n = 0; n < size; n++) { array[k, n] = double.Parse(strs[k*size + n]); } } return Json(array); } }
public ActionResult Index(Graph g) { return null; }