public void DeleteHairSizeSettings(int id)
        {
            HairSizeSettings hairSizeSettings = db.HairSizeSettings.Find(id);

            db.HairSizeSettings.Remove(hairSizeSettings);
            db.SaveChanges();
        }
示例#2
0
        public ActionResult DeleteConfirmed(int id)
        {
            HairSizeSettings hairSizeSettings = db.HairSizeSettings.Find(id);

            db.HairSizeSettings.Remove(hairSizeSettings);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#3
0
 public ActionResult Edit([Bind(Include = "HairSizeSettingsID,LengthOfTelogenHair,DiameterOfVelusTerminal,DiameterOfTerminalsThinMedium,DiameterOfTerminalsMediumThick,RadiusOfFollicularUnits")] HairSizeSettings hairSizeSettings)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hairSizeSettings).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(hairSizeSettings));
 }
示例#4
0
        // GET: HairSizeSettings/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HairSizeSettings hairSizeSettings = db.HairSizeSettings.Find(id);

            if (hairSizeSettings == null)
            {
                return(HttpNotFound());
            }
            return(View(hairSizeSettings));
        }
        public void HairSizeSettingsTest1()
        {
            HairSizeSettings hairSizeSettings;
            int id;

            using (var db = new ApplicationDbContext("DefaultConnection"))
            {
                var ctrl = new MedHairController(db);
                hairSizeSettings = new HairSizeSettings
                {
                    DiameterOfTerminalsMediumThick = 1,
                    DiameterOfTerminalsThinMedium  = 1,
                    DiameterOfVelusTerminal        = 1,
                    LengthOfTelogenHair            = 1,
                    RadiusOfFollicularUnits        = 1,
                };

                id = ctrl.CreateHairSizeSettings(hairSizeSettings);
                var hairSizeSettingsRes = ctrl.GetHairSizeSettings(id);
                Assert.IsNotNull(hairSizeSettingsRes);
                Assert.AreEqual(1, hairSizeSettingsRes.DiameterOfTerminalsMediumThick);
                Assert.AreEqual(1, hairSizeSettingsRes.DiameterOfTerminalsThinMedium);
            }

            using (var db = new ApplicationDbContext("DefaultConnection"))
            {
                var ctrl = new MedHairController(db);
                hairSizeSettings.HairSizeSettingsId             = id;
                hairSizeSettings.DiameterOfTerminalsMediumThick = 2;
                hairSizeSettings.DiameterOfTerminalsThinMedium  = 2;

                ctrl.EditHairSizeSettings(hairSizeSettings);
                var hairSizeSettingsRes = ctrl.GetHairSizeSettings(id);

                Assert.IsNotNull(hairSizeSettingsRes);
                Assert.AreEqual(2, hairSizeSettingsRes.DiameterOfTerminalsMediumThick);
                Assert.AreEqual(2, hairSizeSettingsRes.DiameterOfTerminalsThinMedium);
                Assert.AreEqual(1, hairSizeSettings.DiameterOfVelusTerminal);
                Assert.AreEqual(1, hairSizeSettings.LengthOfTelogenHair);
            }
            using (var db = new ApplicationDbContext("DefaultConnection"))
            {
                var ctrl = new MedHairController(db);
                ctrl.DeleteHairSizeSettings(hairSizeSettings.HairSizeSettingsId);
                var hairSizeSettingsRes = ctrl.GetHairSizeSettings(id);

                Assert.IsNull(hairSizeSettingsRes);
            }
        }
 public int CreateHairSizeSettings(HairSizeSettings hairSizeSettings)
 {
     db.HairSizeSettings.Add(hairSizeSettings);
     db.SaveChanges();
     return(hairSizeSettings.HairSizeSettingsId);
 }
 public void EditHairSizeSettings(HairSizeSettings hairSizeSettings)
 {
     db.Entry(hairSizeSettings).State = EntityState.Modified;
     db.SaveChanges();
 }