Пример #1
0
        public void Delete(int id)
        {
            Stagevoorstel stagevoorstel = _context.Stagevoorstellen.FirstOrDefault(s => s.Id == id);

            _context.Stagevoorstellen.Remove(stagevoorstel);
            _context.SaveChanges();
        }
Пример #2
0
        public void UpdateStatus(Stagevoorstel stagevoorstel)
        {
            var contextStagevoorstel = _context.Stagevoorstellen.FirstOrDefault(s => s.Id == stagevoorstel.Id);

            contextStagevoorstel.Stageopdracht.Status = stagevoorstel.Stageopdracht.Status;
            _context.SaveChanges();
        }
Пример #3
0
        public void UpdateToekennenLector(Stagevoorstel stagevoorstel)
        {
            var contextStagevoorstel = _context.Stagevoorstellen.FirstOrDefault(s => s.Id == stagevoorstel.Id);

            contextStagevoorstel.Stageopdracht.Status = stagevoorstel.Stageopdracht.Status;
            contextStagevoorstel.ReviewLectorId       = stagevoorstel.ReviewLectorId;
            _context.SaveChanges();
        }
 public StagevoorstelBuilder()
 {
     _stagevoorstel = new Stagevoorstel()
     {
         TimeStamp = DateTime.Now
     };
     _random = new Random();
 }
        // POST: api/StageVoorstel
        public IHttpActionResult Post(Stagevoorstel stagevoorstel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            var createdStagevoorstel = _repo.Post(stagevoorstel);

            return(CreatedAtRoute("DefaultApi", new { controller = "Stagevoorstellen", id = createdStagevoorstel.Id }, createdStagevoorstel));
        }
        public IHttpActionResult GetDetailInformation(int id)
        {
            Stagevoorstel stagevoorstel = _repo.GetDetail(id);

            if (stagevoorstel != null)
            {
                return(Ok(stagevoorstel));
            }
            else
            {
                return(NotFound());
            }
        }
Пример #7
0
        public void Update(Stagevoorstel stagevoorstel)
        {
            var contextStagevoorstel = _context.Stagevoorstellen.Include(s => s.Stageopdracht).Include(s => s.Stageopdracht.Contactpersoon).Include(s => s.Stageopdracht.Bedrijfspromotor).FirstOrDefault(s => s.Id == stagevoorstel.Id);

            contextStagevoorstel.Bemerkingen = stagevoorstel.Bemerkingen;

            //Stageopdracht
            contextStagevoorstel.Stageopdracht.VoorkeurAfstudeerrichting =
                stagevoorstel.Stageopdracht.VoorkeurAfstudeerrichting;
            contextStagevoorstel.Stageopdracht.Omschrijving           = stagevoorstel.Stageopdracht.Omschrijving;
            contextStagevoorstel.Stageopdracht.Omgeving               = stagevoorstel.Stageopdracht.Omgeving;
            contextStagevoorstel.Stageopdracht.Randvoorwaarden        = stagevoorstel.Stageopdracht.Randvoorwaarden;
            contextStagevoorstel.Stageopdracht.Onderzoeksthema        = stagevoorstel.Stageopdracht.Onderzoeksthema;
            contextStagevoorstel.Stageopdracht.InleidendeActiviteiten =
                stagevoorstel.Stageopdracht.InleidendeActiviteiten;
            contextStagevoorstel.Stageopdracht.AantalGewensteStagiairs =
                stagevoorstel.Stageopdracht.AantalGewensteStagiairs;
            contextStagevoorstel.Stageopdracht.Periode = stagevoorstel.Stageopdracht.Periode;
            contextStagevoorstel.Stageopdracht.BeschrijvingTechnischeOmgeving =
                stagevoorstel.Stageopdracht.BeschrijvingTechnischeOmgeving;

            //Locatie
            contextStagevoorstel.Stageopdracht.Locatie             = stagevoorstel.Stageopdracht.Locatie;
            contextStagevoorstel.Stageopdracht.AantalWerknemers    = stagevoorstel.Stageopdracht.AantalWerknemers;
            contextStagevoorstel.Stageopdracht.AantalITWerknemers  = stagevoorstel.Stageopdracht.AantalITWerknemers;
            contextStagevoorstel.Stageopdracht.AantalITBegeleiders = stagevoorstel.Stageopdracht.AantalITBegeleiders;

            //Contactpersoon
            if (stagevoorstel.Stageopdracht.Contactpersoon != null)
            {
                contextStagevoorstel.Stageopdracht.Contactpersoon = stagevoorstel.Stageopdracht.Contactpersoon;
            }
            else
            {
                contextStagevoorstel.Stageopdracht.ContactpersoonId = stagevoorstel.Stageopdracht.ContactpersoonId;
            }

            //Bedrijfspromotor
            if (stagevoorstel.Stageopdracht.Bedrijfspromotor != null)
            {
                contextStagevoorstel.Stageopdracht.Bedrijfspromotor = stagevoorstel.Stageopdracht.Bedrijfspromotor;
            }
            else
            {
                contextStagevoorstel.Stageopdracht.BedrijfspromotorId = stagevoorstel.Stageopdracht.BedrijfspromotorId;
            }

            _context.SaveChanges();
        }
Пример #8
0
        public Stagevoorstel Post(Stagevoorstel stagevoorstel)
        {
            if (stagevoorstel.Stageopdracht.Contactpersoon != null)
            {
                _context.Contactpersonen.Add(stagevoorstel.Stageopdracht.Contactpersoon);
            }
            if (stagevoorstel.Stageopdracht.Bedrijfspromotor != null)
            {
                _context.Bedrijfspromotors.Add(stagevoorstel.Stageopdracht.Bedrijfspromotor);
            }

            _context.Stagevoorstellen.Add(stagevoorstel);
            _context.SaveChanges();
            return(stagevoorstel);
        }
        public IHttpActionResult PutReview(int id, Stagevoorstel stagevoorstel)
        {
            if (!ModelState.IsValid || stagevoorstel.Id != id)
            {
                return(BadRequest());
            }

            var rest = _repo.Get(id);

            if (rest != null)
            {
                _repo.UpdateReview(stagevoorstel);
                return(Ok());
            }
            return(NotFound());
        }