Ejemplo n.º 1
0
        public ActionResult Index(OperandsModel model)
        {
            string result = string.Empty;

            try
            {
                result = string.Format("Разница: {0}, Остача от деления: {1}", model.Num1 - model.Num2, model.Num1 % model.Num2);
            }
            catch (Exception e)
            {
                result = e.Message.ToString();
            }
            ViewBag.Result = result;

            return(View());
        }
Ejemplo n.º 2
0
        public ActionResult Index(OperandsModel model)
        {
            string[] mass = new string[model.nums.Length];
            mass = model.nums.Split(' ');
            int[] massInt = new int[mass.Length];
            for (int i = 0; i < mass.Length; i++)
            {
                massInt[i] = Int32.Parse(mass[i]);
            }
            int[]  res    = new int[massInt.Length];
            string result = string.Empty;

            try
            {
                int i = 0;
                foreach (int num in massInt)
                {
                    if (num % 3 == 0)
                    {
                        res[i] = num;
                        i++;
                    }
                }
                int[] rest = new int[i];
                for (int j = 0; j < i; j++)
                {
                    rest[j] = res[j];
                }
                string reslt = string.Join(", ", rest);
                result = string.Format("Різниця: {0} Остача від ділення: {1}, Числа що діляться на 3: {2}",
                                       model.Num1 - model.Num2, model.Num1 % model.Num2, reslt);
            }
            catch (Exception e)
            {
                result = "Виникла помилка: " + e.Message.ToString();
            }

            ViewBag.Result = result; //result container

            return(View());
        }
        public ActionResult Check(OperandsModel model)
        {
            string result = string.Empty;

            Zakaz zak   = new Zakaz();
            var   check = (from zakaz1 in db.Zakazs where zakaz1.IdCar == model.Num1 select zakaz1.Status).First();

            //int ch = Convert.ToInt32(check);
            if (check == 1)
            {
                result = "Работы выполнены";
            }
            else
            {
                result = "Работы выполняются";
            }

            ViewBag.Result = result; //result container

            return(View());
        }