public IActionResult GetAll()
        {
            PrimaryModel pm = new PrimaryModel()
            {
                DLimit = 2, ULimit = 200
            };
            PrimaryNumbers pn = new PrimaryNumbers();

            pm.Numbers = pn.ShowPrimaryNumbers(pm.DLimit, pm.ULimit);
            return(View(pm));
        }
Exemplo n.º 2
0
        private void btnGener_Click(object sender, EventArgs e)
        {
            int            dolny  = Convert.ToInt32(tbDolny.Text);
            int            gorny  = Convert.ToInt32(tbGorny.Text);
            PrimaryNumbers pn     = new PrimaryNumbers();
            var            liczby = pn.ShowPrimaryNumbers(dolny, gorny);
            StringBuilder  sb     = new StringBuilder();

            sb.AppendLine("Ilość liczb pierwszych: " + liczby.Count);
            foreach (int i in liczby)
            {
                sb.Append(i.ToString() + " ");
            }

            tbWynik.Text = sb.ToString();
            lbWynik.Text = liczby.Count.ToString();
        }
        public IActionResult Index(PrimaryModel pm)
        {
            if (ModelState.IsValid)
            {
                PrimaryNumbers pn = new PrimaryNumbers();
                if (pm.ULimit < pm.DLimit)
                {
                    int temp = pm.DLimit;
                    pm.DLimit = pm.ULimit;
                    pm.ULimit = temp;
                }

                const int rowWidth = 20;
                int       rows     = (pm.ULimit - pm.DLimit) / rowWidth + 1;
                ViewBag.rows     = rows;
                ViewBag.rowWidth = rowWidth;
                pm.Numbers       = pn.ShowPrimaryNumbers(pm.DLimit, pm.ULimit);
                return(View(pm));
            }
            else
            {
                return(View(pm));
            }
        }