コード例 #1
0
        // GET: /Admin/Anticorrosive
        public ActionResult Anticorrosive()
        {
            if (!User.IsInRole("admin"))
            {
                return(View("Error"));
            }

            List <Anticorrosive> anticorrosives = new List <Anticorrosive>();

            using (OvpNgContext db = new OvpNgContext())
            {
                anticorrosives
                .AddRange(db.Anticorrosives);
            }

            return(View(anticorrosives));
        }
コード例 #2
0
        // TODO: Rework this controllers to pattern in future:
        // GET: /Admin/ThermalIsolation
        public ActionResult ThermalIsolation()
        {
            if (!User.IsInRole("admin"))
            {
                return(View("Error"));
            }

            List <ThermalIsolation> thermalIsolations = new List <ThermalIsolation>();

            using (OvpNgContext db = new OvpNgContext())
            {
                thermalIsolations
                .AddRange(db.ThermalIsolations);
            }

            return(View(thermalIsolations));
        }
コード例 #3
0
ファイル: ObjectModel.cs プロジェクト: alexpapay/HermesWeb
        public ObjectModel()
        {
            OvpNgContext objectContext = new OvpNgContext();

            Companies         = new SelectList(objectContext.Companies, "Id", "Name");
            Stages            = new SelectList(objectContext.Stages, "Id", "Name");
            ConstructionTypes = new SelectList(objectContext.ConstructionTypes, "Id", "Name");
            GeoDataDistricts  = new SelectList(objectContext.GeoDataDistricts, "Id", "Name");

            DateTime currentTime = DateTime.Now;

            ObjectStart        = currentTime;
            ObjectFinish       = currentTime;
            ConstructionStart  = currentTime;
            ConstructionFinish = currentTime;
            DesignStart        = currentTime;
            DesignFinish       = currentTime;
        }
コード例 #4
0
        public ActionResult AddAnticorrosive(Anticorrosive anticorrosive)
        {
            if (!User.IsInRole("admin"))
            {
                return(View("Error"));
            }

            using (OvpNgContext db = new OvpNgContext())
            {
                DateTime dateTimeNow = DateTime.Now;
                anticorrosive.CreatedAt  = dateTimeNow;
                anticorrosive.LastEditAt = dateTimeNow;
                anticorrosive.LastEditBy = User.Identity.Name;
                anticorrosive.CreatedBy  = User.Identity.Name;

                db.Anticorrosives.Add(anticorrosive);
                db.SaveChanges();
            }

            return(RedirectToAction("Anticorrosive"));
        }
コード例 #5
0
        public ActionResult DeleteAnticorrosive(Anticorrosive anticorrosive)
        {
            if (!User.IsInRole("admin"))
            {
                return(View("Error"));
            }

            using (OvpNgContext db = new OvpNgContext())
            {
                Anticorrosive deletingAnticorrosive = new Anticorrosive
                {
                    Id = anticorrosive.Id
                };

                db.Anticorrosives.Attach(deletingAnticorrosive);
                db.Anticorrosives.Remove(deletingAnticorrosive);

                db.SaveChanges();
            }
            return(RedirectToAction("Anticorrosive"));
        }
コード例 #6
0
        public ActionResult AddThermalIsolation(ThermalIsolation thermalIsolation)
        {
            if (!User.IsInRole("admin"))
            {
                return(View("Error"));
            }

            using (OvpNgContext db = new OvpNgContext())
            {
                DateTime dateTimeNow = DateTime.Now;
                thermalIsolation.CreatedAt  = dateTimeNow;
                thermalIsolation.LastEditAt = dateTimeNow;
                thermalIsolation.LastEditBy = User.Identity.Name;
                thermalIsolation.CreatedBy  = User.Identity.Name;

                db.ThermalIsolations.Add(thermalIsolation);
                db.SaveChanges();
            }

            return(RedirectToAction("ThermalIsolation"));
        }
コード例 #7
0
        public ActionResult DeleteThermalIsolation(ThermalIsolation thermalIsolation)
        {
            if (!User.IsInRole("admin"))
            {
                return(View("Error"));
            }

            using (OvpNgContext db = new OvpNgContext())
            {
                ThermalIsolation deletingThermalIsolation = new ThermalIsolation
                {
                    Id = thermalIsolation.Id
                };

                db.ThermalIsolations.Attach(deletingThermalIsolation);
                db.ThermalIsolations.Remove(deletingThermalIsolation);

                db.SaveChanges();
            }
            return(RedirectToAction("ThermalIsolation"));
        }
コード例 #8
0
        public ActionResult DeleteConstructionType(ConstructionType constructionType)
        {
            if (!User.IsInRole("admin"))
            {
                return(View("Error"));
            }

            using (OvpNgContext db = new OvpNgContext())
            {
                ConstructionType deletingConstructionType = new ConstructionType
                {
                    Id = constructionType.Id
                };

                db.ConstructionTypes.Attach(deletingConstructionType);
                db.ConstructionTypes.Remove(deletingConstructionType);

                db.SaveChanges();
            }
            return(RedirectToAction("ConstructionType"));
        }
コード例 #9
0
ファイル: HomeRepository.cs プロジェクト: alexpapay/HermesWeb
 public HomeRepository(OvpNgContext db)
 {
     _db = db;
 }
コード例 #10
0
 public AdminRepository(OvpNgContext db)
 {
     _db = db;
 }
コード例 #11
0
ファイル: Company.cs プロジェクト: alexpapay/HermesWeb
        public Company()
        {
            OvpNgContext objectContext = new OvpNgContext();

            CompanyProfiles = new SelectList(objectContext.CompanyProfiles, "Id", "Name");
        }
コード例 #12
0
 public StaticticRepository(OvpNgContext db)
 {
     _db = db;
 }