Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 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);
     }
 }
Exemplo n.º 3
0
 public ActionResult Index(Graph g)
 {
     return null;
 }