public void DeleteStatisticalSettings(int id) { StatisticalSettings statisticalSettings = db.StatisticalSettings.Find(id); db.StatisticalSettings.Remove(statisticalSettings); db.SaveChanges(); }
public ActionResult DeleteConfirmed(int id) { StatisticalSettings statisticalSettings = db.StatisticalSettings.Find(id); db.StatisticalSettings.Remove(statisticalSettings); db.SaveChanges(); return(RedirectToAction("Index")); }
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)); }
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)); }
// 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); }