예제 #1
0
 public ActionResult <BusChauffeur> VoegBusChauffeurToe(BusChauffeurDTO dto)
 {
     try
     {
         BusChauffeur bc = new BusChauffeur();
         bc.Voornaam      = dto.Voornaam;
         bc.Achternaam    = dto.Achternaam;
         bc.Uurloon       = dto.Uurloon;
         bc.GeboorteDatum = dto.GeboorteDatum;
         bc.Email         = dto.Email;
         _busChauffeurRepository.Add(bc);
         _busChauffeurRepository.SaveChanges();
         return(bc);
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
예제 #2
0
        public ActionResult <BusChauffeur> PutItem(string id, BusChauffeurDTO dto)
        {
            try
            {
                if (!dto.Id.Equals(id))
                {
                    return(BadRequest("Id's komen niet overeen!"));
                }

                BusChauffeur bc = _busChauffeurRepository.GetBy(id);
                bc.Voornaam      = dto.Voornaam;
                bc.Achternaam    = dto.Achternaam;
                bc.Uurloon       = dto.Uurloon;
                bc.GeboorteDatum = dto.GeboorteDatum;
                bc.Email         = dto.Email;
                _busChauffeurRepository.Update(bc);
                _busChauffeurRepository.SaveChanges();
                return(bc);
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }