public void DeleteStatisticalSettings(int id)
        {
            StatisticalSettings statisticalSettings = db.StatisticalSettings.Find(id);

            db.StatisticalSettings.Remove(statisticalSettings);
            db.SaveChanges();
        }
Example #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            StatisticalSettings statisticalSettings = db.StatisticalSettings.Find(id);

            db.StatisticalSettings.Remove(statisticalSettings);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #3
0
 public ActionResult Edit([Bind(Include = "StatisticalSettingsID,AnagenAll,TelogenAll,AnagenTerm,TelogenTerm,AnagenVallus,TelogenVallus")] StatisticalSettings statisticalSettings)
 {
     if (ModelState.IsValid)
     {
         db.Entry(statisticalSettings).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(statisticalSettings));
 }
Example #4
0
        public ActionResult Create([Bind(Include = "StatisticalSettingsID,AnagenAll,TelogenAll,AnagenTerm,TelogenTerm,AnagenVallus,TelogenVallus")] StatisticalSettings statisticalSettings)
        {
            if (ModelState.IsValid)
            {
                db.StatisticalSettings.Add(statisticalSettings);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(statisticalSettings));
        }
Example #5
0
        // GET: StatisticalSettings/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StatisticalSettings statisticalSettings = db.StatisticalSettings.Find(id);

            if (statisticalSettings == null)
            {
                return(HttpNotFound());
            }
            return(View(statisticalSettings));
        }
        public void StatisticalSettingsTest1()
        {
            StatisticalSettings statisticalSettings;
            int id;

            using (var db = new ApplicationDbContext("DefaultConnection"))
            {
                var ctrl = new MedHairController(db);
                statisticalSettings = new StatisticalSettings
                {
                    AnagenAll     = 1,
                    TelogenAll    = 1,
                    AnagenTerm    = 1,
                    TelogenTerm   = 1,
                    AnagenVallus  = 1,
                    TelogenVallus = 1,
                };

                id = ctrl.CreateStatisticalSettings(statisticalSettings);
                var statisticalSettingsRes = ctrl.GetStatisticalSettings(id);

                Assert.IsNotNull(statisticalSettingsRes);
                Assert.AreEqual(1, statisticalSettingsRes.AnagenAll);
                Assert.AreEqual(1, statisticalSettingsRes.AnagenVallus);
            }

            using (var db = new ApplicationDbContext("DefaultConnection"))
            {
                var ctrl = new MedHairController(db);
                statisticalSettings.StatisticalSettingsID = id;
                statisticalSettings.AnagenAll             = 55;
                statisticalSettings.AnagenVallus          = 55;

                ctrl.EditStatisticalSettings(statisticalSettings);
                var statisticalSettingsRes = ctrl.GetStatisticalSettings(id);
                Assert.IsNotNull(statisticalSettingsRes);
                Assert.AreEqual(55, statisticalSettingsRes.AnagenAll);
                Assert.AreEqual(55, statisticalSettingsRes.AnagenVallus);
                Assert.AreEqual(1, statisticalSettingsRes.AnagenTerm);
                Assert.AreEqual(1, statisticalSettingsRes.TelogenAll);
            }
            using (var db = new ApplicationDbContext("DefaultConnection"))
            {
                var ctrl = new MedHairController(db);
                ctrl.DeleteStatisticalSettings(statisticalSettings.StatisticalSettingsID);
                var statisticalSettingsRes = ctrl.GetStatisticalSettings(id);
                Assert.IsNull(statisticalSettingsRes);
            }
        }
 public void EditStatisticalSettings(StatisticalSettings statisticalSettings)
 {
     db.Entry(statisticalSettings).State = EntityState.Modified;
     db.SaveChanges();
 }
 public int CreateStatisticalSettings(StatisticalSettings statisticalSettings)
 {
     db.StatisticalSettings.Add(statisticalSettings);
     db.SaveChanges();
     return(statisticalSettings.StatisticalSettingsID);
 }