// GET: /FicheSecurite/CreateBackBone public ActionResult CreateBackBone() { FicheSecuriteViewModel FicheSecuriteViewModel = new FicheSecuriteViewModel(); return(View("~/Views/HSE/FicheSecurite/Create_BackBone.cshtml")); }
// GET api/fichesecuriteapi/5 public HttpResponseMessage Get(int id) { var boo = User.Identity.IsAuthenticated; var z = User.Identity.GetUserId(); var p = 1; _activeDirectoryUtilisateurRepository = new ActiveDirectoryUtilisateurRepository(); FicheSecurite ficheSecurite; List <Zone> AllZone; List <Lieu> AllLieu; List <Service> AllService; List <PosteDeTravail> AllPosteDeTravail; // Si l'ID = -1 >> Nouvelle Fiche if (id == -1) { Site SiteUser = _activeDirectoryUtilisateurRepository.GetCurrentUserSite(); ficheSecurite = new FicheSecurite() { CotationFrequence = 1, CotationGravite = 1, SiteId = SiteUser.SiteID, WorkFlowDiffusee = false, WorkFlowAttenteASEValidation = false, WorkFlowASEValidee = false, WorkFlowASERejetee = false, WorkFlowCloturee = false }; var queryZone = from a in db.Zones where a.SiteId == SiteUser.SiteID select a; AllZone = queryZone.ToList(); AllLieu = new List <Lieu>(); var queryService = from a in db.Services where a.SiteId == SiteUser.SiteID select a; AllService = queryService.ToList(); AllPosteDeTravail = new List <PosteDeTravail>(); } // Si l'ID != -1 >> Fiche existante else { ficheSecurite = _ficheSecuriteRepository.Get(id); if (ficheSecurite == null) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } var queryZone = from a in db.Zones where a.SiteId == ficheSecurite.SiteId select a; AllZone = queryZone.ToList(); var queryLieu = from a in db.Lieux where a.ZoneId == ficheSecurite.ZoneId orderby a.Rang select a; AllLieu = queryLieu.ToList(); var queryService = from a in db.Services where a.SiteId == ficheSecurite.SiteId select a; AllService = queryService.ToList(); var queryPosteDeTravail = from a in db.PosteDeTravails where a.ZoneId == ficheSecurite.ZoneId orderby a.Rang select a; AllPosteDeTravail = queryPosteDeTravail.ToList(); } var ficheSecuriteViewModel = new FicheSecuriteViewModel(ficheSecurite, AllZone, AllLieu, AllService, AllPosteDeTravail); return(Request.CreateResponse(HttpStatusCode.OK, ficheSecuriteViewModel)); }