Example #1
0
        public ActionResult Exec(string operation, string args)
        {
            if (string.IsNullOrWhiteSpace(args))
            {
                return(Content("Укажите входные данные"));
            }

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            var result = Calc.Exec(operation, args.Split(new[] { ' ', ',' }));

            stopWatch.Stop();

            #region Сохранение в БД
            var oper    = OperationRepository.GetOrCreate(operation);
            var curUser = UserRepository.GetByLogin(User.Identity.Name);

            var or = new OperationResult()
            {
                Operation     = oper,
                Result        = result,
                ExecutionTime = stopWatch.ElapsedMilliseconds,
                Error         = "",
                Args          = args.Trim(),
                CreationDate  = DateTime.Now,
                Author        = curUser
            };

            OperationResultRepository.Save(or);

            #endregion

            return(PartialView("Result", or));
        }