Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            PiModel piModel = db.PiModels.Find(id);

            db.PiModels.Remove(piModel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "PiModelId,ModelName,NumberofPin")] PiModel piModel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(piModel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(piModel));
 }
Exemplo n.º 3
0
        public ActionResult Create([Bind(Include = "PiModelId,ModelName,NumberofPin")] PiModel piModel)
        {
            if (ModelState.IsValid)
            {
                db.PiModels.Add(piModel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(piModel));
        }
Exemplo n.º 4
0
        // GET: PiModels/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PiModel piModel = db.PiModels.Find(id);

            if (piModel == null)
            {
                return(HttpNotFound());
            }
            return(View(piModel));
        }
Exemplo n.º 5
0
        public IActionResult Index(int?dp = 6)
        {
            var stopwatch = Stopwatch.StartNew();

            HighPrecision.Precision = dp.Value;
            HighPrecision first  = 4 * Atan.Calculate(5);
            HighPrecision second = Atan.Calculate(239);

            var pi = 4 * (first - second);

            var model = new PiModel
            {
                DecimalPlaces       = dp.Value,
                Value               = pi.ToString(),
                ComputeMilliseconds = stopwatch.ElapsedMilliseconds,
                ComputeHost         = Environment.MachineName
            };

            return(View(model));
        }
Exemplo n.º 6
0
 public static string GetModelName(PiModel model)
 {
     return(piModelNames[model]);
 }