public foerderkursModule(FoerderkursService foerderkursService) : base("/foerderkurs") { Get["/"] = p => { var auftraege = foerderkursService.Get(); return(new JsonResponse(foerderkurs, new JsonNetSerializer())); }; Get["/{id}"] = p => { var foerderkurs = foerderkursService.Get(p.id); if (foerderkurs == null) { return(HttpStatusCode.NotFound); } return(new JsonResponse(foerderkurs, new JsonNetSerializer())); }; Get["/byKundeId/{id}"] = p => { var foerderkurse = foerderkursService.GetBySchueler(p.id); return(new JsonResponse(foerderkurse, new JsonNetSerializer())); }; Post["/"] = p => { Foerderkurs post = this.Bind(); try { var result = foerderkursService.Add(post); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(new JsonResponse(post, new JsonNetSerializer())); }; Put["/"] = p => { Foerderkurs put = this.Bind(); try { var result = foerderkursService.Update(put); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.OK); }; Delete["/{id}"] = p => { try { var result = foerderkursService.Delete(p.id); return(new JsonResponse(result, new DefaultJsonSerializer())); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } }; }
public PassModule(PassService passService) : base("/paesse") { Get["/"] = p => { var paesse = passService.Get(); return(new JsonResponse(paesse, new JsonNetSerializer())); }; Get["/{id}"] = p => { var pass = passService.Get(p.id); if (pass == null) { return(HttpStatusCode.NotFound); } return(new JsonResponse(pass, new JsonNetSerializer())); }; Post["/"] = p => { Pass post = this.Bind(); try { var result = passService.Add(post); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.Created); }; Put["/"] = p => { Pass put = this.Bind(); try { var result = passService.Update(put); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.OK); }; Delete["/{id}"] = p => { try { var result = passService.Delete(p.id); return(new JsonResponse(result, new DefaultJsonSerializer())); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } }; }
public GutscheinModule(GutscheinService gutscheinService) : base("/gutscheine") { Get["/"] = p => { var gutscheine = gutscheinService.Get(); return(new JsonResponse(gutscheine, new JsonNetSerializer())); }; Get["/{id}"] = p => { var gutschein = gutscheinService.Get(p.id); if (gutschein == null) { return(HttpStatusCode.NotFound); } return(new JsonResponse(gutschein, new JsonNetSerializer())); }; Post["/"] = p => { Gutschein post = this.Bind(); try { var result = gutscheinService.Add(post); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.Created); }; Put["/"] = p => { Gutschein put = this.Bind(); try { var result = gutscheinService.Update(put); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.OK); }; Delete["/{id}"] = p => { try { var result = gutscheinService.Delete(p.id); return(new JsonResponse(result, new DefaultJsonSerializer())); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } }; }
public KursleiterModule(KursleiterService kursleiterService) : base("/kursleiter") { Get["/"] = p => { var kursleiter = kursleiterService.Get(); return(new JsonResponse(kursleiter, new JsonNetSerializer())); }; Get["/{id}"] = p => { var kursleiter = kursleiterService.Get(p.id); if (kursleiter == null) { return(HttpStatusCode.NotFound); } return(new JsonResponse(kursleiter, new JsonNetSerializer())); }; Post["/"] = p => { Kursleiter post = this.Bind(); try { var result = kursleiterService.Add(post); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.Created); }; Put["/"] = p => { Kursleiter put = this.Bind(); try { var result = kursleiterService.Update(put); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.OK); }; Delete["/{id}"] = p => { try { var result = kursleiterService.Delete(p.id); return(new JsonResponse(result, new DefaultJsonSerializer())); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } }; }
public BestellungModule(BestellungService bestellungService) : base("/bestellungen") { Get["/"] = p => { var bestellungen = bestellungService.Get(); return(new JsonResponse(bestellungen, new JsonNetSerializer())); }; Get["/{id}"] = p => { var bestellung = bestellungService.Get(p.id); if (bestellung == null) { return(HttpStatusCode.NotFound); } return(new JsonResponse(bestellung, new JsonNetSerializer())); }; Post["/"] = p => { Bestellung post = this.Bind(); try { var result = bestellungService.Add(post); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.Created); }; Put["/"] = p => { Bestellung put = this.Bind(); try { var result = bestellungService.Update(put); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.OK); }; Delete["/{id}"] = p => { try { var result = bestellungService.Delete(p.id); return(new JsonResponse(result, new DefaultJsonSerializer())); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } }; }
public LieferantenModule(LieferantenService lieferantenService) : base("/lieferanten") { Get["/"] = p => { var lieferanten = lieferantenService.Get(); return(new JsonResponse(lieferanten, new JsonNetSerializer())); }; Get["/{id}"] = p => { var lieferanten = lieferantenService.Get(p.id); if (lieferanten == null) { return(HttpStatusCode.NotFound); } return(new JsonResponse(lieferanten, new JsonNetSerializer())); }; //Get["/{Firma}"] = p => //{ // var lieferanten = lieferantenService.GetByFirma(p.Firma); // if(lieferanten==null) // { // return HttpStatusCode.NotFound; // } // return new JsonResponse(lieferanten, new JsonNetSerializer()); //}; Post["/"] = p => { Lieferanten post = this.Bind(); try { var result = lieferantenService.Add(post); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.Created); }; Put["/"] = p => { Lieferanten put = this.Bind(); try { var result = lieferantenService.Update(put); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.OK); }; Delete["/{id}"] = p => { try { var result = lieferantenService.Delete(p.id); return(new JsonResponse(result, new DefaultJsonSerializer())); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } }; }
public FirmendatenModule(FirmendatenService firmendatenService) : base("/firmendaten") { Get["/"] = p => { var daten = firmendatenService.Get(); return(new JsonResponse(daten, new JsonNetSerializer())); }; //Get["/{id}"] = p => //{ // var daten = firmendatenService.Get(p.id); // if(daten == null) // { // return HttpStatusCode.NotFound; // } // return new JsonResponse(daten, new JsonNetSerializer()); //}; //Get["/byUserId/{id}"] = p => //{ // var books = bookService.GetByUser(p.id); // return new JsonResponse(books, new JsonNetSerializer()); //}; Post["/"] = p => { Firmendaten post = this.Bind(); try { var result = firmendatenService.Add(post); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.Created); }; Put["/"] = p => { Firmendaten put = this.Bind(); try { var result = firmendatenService.Update(put); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.OK); }; Delete["/{id}"] = p => { try { var result = firmendatenService.Delete(p.id); return(new JsonResponse(result, new DefaultJsonSerializer())); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } }; }
public FormularModule(FormularService formularService) : base("/formulare") { Get["/"] = p => { var formulare = formularService.Get(); return(new JsonResponse(formulare, new JsonNetSerializer())); }; Get["/{id}"] = p => { var formular = formularService.Get(p.id); if (formular == null) { return(HttpStatusCode.NotFound); } return(new JsonResponse(formular, new JsonNetSerializer())); }; //Get["/byUserId/{id}"] = p => //{ // var books = bookService.GetByUser(p.id); // return new JsonResponse(books, new JsonNetSerializer()); //}; Post["/"] = p => { Formular post = this.Bind(); try { var result = formularService.Add(post); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.Created); }; Put["/"] = p => { Formular put = this.Bind(); try { var result = formularService.Update(put); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.OK); }; Delete["/{id}"] = p => { try { var result = formularService.Delete(p.id); return(new JsonResponse(result, new DefaultJsonSerializer())); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } }; }
public LoginModule(LoginService loginService) : base("/logins") { Get["/"] = p => { var logins = loginService.Get(); return(new JsonResponse(logins, new JsonNetSerializer())); }; Get["/{id}"] = p => { var login = loginService.Get(p.id); if (login == null) { return(HttpStatusCode.NotFound); } return(new JsonResponse(login, new JsonNetSerializer())); }; //Get["/byUserId/{id}"] = p => //{ // var books = loginService.GetByUser(p.id); // return new JsonResponse(login, new JsonNetSerializer()); //}; Post["/"] = p => { Login post = this.Bind(); try { var result = loginService.Add(post); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.Created); }; Put["/"] = p => { Login put = this.Bind(); try { var result = loginService.Update(put); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.OK); }; Delete["/{id}"] = p => { try { var result = loginService.Delete(p.id); return(new JsonResponse(result, new DefaultJsonSerializer())); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } }; }
public TitelModule(TitelService titelService) : base("/titel") { Get["/"] = p => { var titel = titelService.Get(); return(new JsonResponse(titel, new JsonNetSerializer())); }; Get["/{id}"] = p => { var titel = titelService.Get(p.id); if (titel == null) { return(HttpStatusCode.NotFound); } return(new JsonResponse(titel, new JsonNetSerializer())); }; Post["/"] = p => { Titel post = this.Bind(); try { var result = titelService.Add(post); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.Created); }; Put["/"] = p => { Titel put = this.Bind(); try { var result = titelService.Update(put); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.OK); }; Delete["/{id}"] = p => { try { var result = titelService.Delete(p.id); return(new JsonResponse(result, new DefaultJsonSerializer())); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } }; }
public MitgliedschaftKontaktModule(MitgliedschaftKontaktService mitgliedschaftKontaktService) : base("/mitgliedschaftKontakte") { Get["/"] = p => { var mitgliedschaftKontakte = mitgliedschaftKontaktService.Get(); return(new JsonResponse(mitgliedschaftKontakte, new JsonNetSerializer())); }; Get["/{id}"] = p => { var mitgliedschaftKontakt = mitgliedschaftKontaktService.Get(p.id); if (mitgliedschaftKontakt == null) { return(HttpStatusCode.NotFound); } return(new JsonResponse(mitgliedschaftKontakt, new JsonNetSerializer())); }; Post["/"] = p => { MitgliedschaftKontakt post = this.Bind(); try { var result = mitgliedschaftKontaktService.Add(post); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.Created); }; Put["/"] = p => { MitgliedschaftKontakt put = this.Bind(); try { var result = mitgliedschaftKontaktService.Update(put); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.OK); }; Delete["/{id}"] = p => { try { var result = mitgliedschaftKontaktService.Delete(p.id); return(new JsonResponse(result, new DefaultJsonSerializer())); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } }; }
public StaatsbuergerschaftModule(StaatsbuergerschaftService staatsbuergerschaftService) : base("/staatsbuergerschaften") { Get["/"] = p => { var staatsbuergerschaften = staatsbuergerschaftService.Get(); return(new JsonResponse(staatsbuergerschaften, new JsonNetSerializer())); }; Get["/{id}"] = p => { var staatsbuergerschaft = staatsbuergerschaftService.Get(p.id); if (staatsbuergerschaft == null) { return(HttpStatusCode.NotFound); } return(new JsonResponse(staatsbuergerschaft, new JsonNetSerializer())); }; Post["/"] = p => { Staatsbuergerschaft post = this.Bind(); try { var result = staatsbuergerschaftService.Add(post); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.Created); }; Put["/"] = p => { Staatsbuergerschaft put = this.Bind(); try { var result = staatsbuergerschaftService.Update(put); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.OK); }; Delete["/{id}"] = p => { try { var result = staatsbuergerschaftService.Delete(p.id); return(new JsonResponse(result, new DefaultJsonSerializer())); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } }; }
public ArtikelModule(ArtikelService artikelService, LieferantenService lieferantenService) : base("/artikel") { Get["/"] = p => { var artikel = artikelService.Get(); return(new JsonResponse(artikel, new JsonNetSerializer())); }; Get["/{id}"] = p => { var artikel = artikelService.Get(p.id); if (artikel == null) { return(HttpStatusCode.NotFound); } return(new JsonResponse(artikel, new JsonNetSerializer())); }; //Get["/{aktiv}"] = p => //{ // var artikel = artikelService.Get(p.aktiv); // if (artikel == null) // { // return HttpStatusCode.NotFound; // } // return new JsonResponse(artikel, new JsonNetSerializer()); //}; Post["/"] = p => { Artikel post = this.Bind(); try { var result = artikelService.Add(post); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.Created); }; Put["/"] = p => { Artikel put = this.Bind(); try { var result = artikelService.Update(put); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.OK); }; Delete["/{id}"] = p => { try { var result = artikelService.Delete(p.id); return(new JsonResponse(result, new DefaultJsonSerializer())); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } }; Post["/lieferanten/{LieferantenID}"] = p => { Lieferanten l = lieferantenService.Get(p.LieferantenID); Artikel post = this.Bind(); post.Lieferant = l; l.Artikel.Add(post); try { var result = artikelService.Add(post); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.Created); }; }
public Foerderkurs_Schueler_Module(Foerderkurs_Schueler_Service foerderkurs_schueler_Service, foerderkursService foederkursService, SchuelerService schuelerService) : base("/foederkurs_schueler") { //Passwortabsicherung des Moduls //this.RequiresAuthentication(); Get["/"] = p => { var foeSch = foerderkurs_schueler_Service.Get(); return(new JsonResponse(aufArt, new JsonNetSerializer())); }; Get["/bySchuelerID/{id}"] = p => { var foeSch = foerderkurs_schueler_Service.GetBySchueler(p.id); return(new JsonResponse(foeSch, new JsonNetSerializer())); }; Post["/"] = p => { foerderkurs_Schueler post = this.Bind(); try { var result = foerderkurs_schueler_Service.Add(post); } catch (Exception ex) { log.errorLog(ex.Message); Console.WriteLine(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.Created); }; Post["/Schueler/{schuelerID}/Foerderkurs/{foederkursID}"] = p => { Schueler sch = schuelerService.Get(p.SchuelerID); Foederkurs foe = foerderkursService.Get(p.FoederkursID); Foerderkurs_Schueler post = this.Bind(); post.Schueler = sch; post.Foerderkurs = foe; sch.foerderkursSchueler.Add(post); foe.foerderkursSchueler.Add(post); try { var result = foerderkurs_schueler_Service.Add(post); } catch (Exception ex) { log.errorLog(ex.Message); Console.WriteLine(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.Created); }; Put["/"] = p => { foederkurs_Schueler put = this.Bind(); try { var result = foerderkurs_schueler_Service.Update(put); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.OK); }; Delete["/{id}"] = p => { try { var result = foerderkurs_schueler_Service.Delete(p.id); return(new JsonResponse(result, new DefaultJsonSerializer())); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } }; }
public AltersgruppeModule(AltersgruppeService altersgruppeService) : base("/altersgruppen") { Get["/"] = p => { var altersgruppen = altersgruppeService.Get(); return(new JsonResponse(altersgruppen, new JsonNetSerializer())); }; Get["/{id}"] = p => { var altersgruppe = altersgruppeService.Get(p.id); if (altersgruppe == null) { return(HttpStatusCode.NotFound); } return(new JsonResponse(altersgruppe, new JsonNetSerializer())); }; Post["/"] = p => { Altersgruppe post = this.Bind(); try { var result = altersgruppeService.Add(post); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.Created); }; Put["/"] = p => { Altersgruppe put = this.Bind(); try { var result = altersgruppeService.Update(put); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.OK); }; Delete["/{id}"] = p => { try { var result = altersgruppeService.Delete(p.id); return(new JsonResponse(result, new DefaultJsonSerializer())); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } }; }