Пример #1
0
        public ActionResult DeleteConfirmed(long id)
        {
            SoilConfiguration sc = new SoilConfiguration();
            Soil soil            = db.Soils.Find(id);

            sc.Disable(soil);
            db.SaveChanges();

            return(Redirect("/Soils"));
        }
Пример #2
0
        /// <summary>
        ///  Logical elimination
        /// </summary>
        /// <param name="pFarm"></param>
        /// <returns></returns>
        public void Disable(Farm pFarm)
        {
            SoilConfiguration           sc           = new SoilConfiguration();
            IrrigationUnitConfiguration iuc          = new IrrigationUnitConfiguration();
            List <Soil>           listSoil           = pFarm.SoilList;
            List <IrrigationUnit> listIrrigationUnit = pFarm.IrrigationUnitList;

            foreach (Soil soil in listSoil)
            {
                sc.Disable(soil);
            }

            foreach (IrrigationUnit irrigationUnit in listIrrigationUnit)
            {
                iuc.Disable(irrigationUnit);
            }

            pFarm.IsActive = false;

            db.Entry(pFarm).State = EntityState.Modified;
            //db.SaveChanges();
        }