// 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)); }
// 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)); }
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; }
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")); }
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")); }
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")); }
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")); }
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")); }
public HomeRepository(OvpNgContext db) { _db = db; }
public AdminRepository(OvpNgContext db) { _db = db; }
public Company() { OvpNgContext objectContext = new OvpNgContext(); CompanyProfiles = new SelectList(objectContext.CompanyProfiles, "Id", "Name"); }
public StaticticRepository(OvpNgContext db) { _db = db; }