public void Update(AntColonyResult item)
 {
     /*
     _antColonyResultContext.Entities.Remove(Get(item.ModelId));
     _antColonyResultContext.Entities.Add(item);
     _antColonyResultContext.SaveChanges();
     */
     _antColonyResultContext.Entry(item).State = EntityState.Modified;
     _antColonyResultContext.SaveChanges();
 }
Пример #2
0
        public ActionResult FileInput(HttpPostedFileBase file)
        {
            if (file.ContentLength > 0)
            {
                _creator.InputData(file.InputStream);
                var antColonyAlgorithm = _creator.CreateAcAlgorithm();
                antColonyAlgorithm.Run();
                var result = antColonyAlgorithm.Result();
                using (var reader = new StreamReader(result))
                {
                    ViewData["result"] = reader.ReadToEnd();
                }

                var dbModel = _creator.CreateDbModel();
                var dbResult = new AntColonyResult {Result = ViewData["result"].ToString() };
                _antColonyModelRep.Add(dbModel);
                dbModel = _antColonyModelRep.GetAll().Last();
                dbResult.ModelId = dbModel.ModelId;
                _antColonyResultRep.Add(dbResult);
            }

            return View("Result");
        }
 public void Add(AntColonyResult item)
 {
     _antColonyResultContext.Entities.Add(item);
     _antColonyResultContext.SaveChanges();
 }
Пример #4
0
        public ActionResult HtmlInput(AlgorithmInput data)
        {
            _creator.InputData(data.GenerateAlgoritmInput());
            var antColonyAlgorithm = _creator.CreateAcAlgorithm();
            antColonyAlgorithm.Run();
            var result = antColonyAlgorithm.Result();
            using (var reader = new StreamReader(result))
            {
                ViewData["result"] = reader.ReadToEnd();
            }

            var dbModel = _creator.CreateDbModel();
            var dbResult = new AntColonyResult { Result = ViewData["result"].ToString() };
            _antColonyModelRep.Add(dbModel);
            dbModel = _antColonyModelRep.GetAll().Last();
            dbResult.ModelId = dbModel.ModelId;
            _antColonyResultRep.Add(dbResult);

            return View("Result");
        }