// [Authorize] public async Task <HttpResponseMessage> Update(LABORATOIRE Labo) { try { var UserBd = laboService.GetLaboratoire(Labo.ID); if (UserBd == null) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } UserBd.NAMEL = Labo.NAMEL; UserBd.DESCRIPTIONS = Labo.DESCRIPTIONS; UserBd.DESCRIPTIONS = Labo.DESCRIPTIONS; UserBd.MAIL = Labo.MAIL; UserBd.PHONE = Labo.PHONE; UserBd.CITY = Labo.CITY; UserBd.CODEPOSTAL = Labo.CODEPOSTAL; bool IsModified = laboService.Modifier(Labo); return(Request.CreateResponse(HttpStatusCode.OK, IsModified)); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.BadRequest, ex)); } }
public async Task <HttpResponseMessage> Get(int id) { try { // id = laboService.GetLaboratoires().Take(1).FirstOrDefault().ID; LABORATOIRE infoLabo = laboService.GetLaboratoire(id); return(Request.CreateResponse(HttpStatusCode.OK, infoLabo)); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.BadRequest, ex)); } }
public async Task <HttpResponseMessage> Add(LABORATOIRE Labo) { try { if (Labo == null) { int id = laboService.GetLaboratoires().Take(1).FirstOrDefault().ID; Labo = laboService.GetLaboratoire(id); Labo.NAMEL = "LABO_Bizerte"; Labo.DESCRIPTIONS = "New_Labo_LastName"; } bool IsAdded = laboService.Ajouter(Labo); return(Request.CreateResponse(HttpStatusCode.OK, IsAdded)); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.BadRequest, ex)); } }
public async Task <HttpResponseMessage> Delete(int Id) { try { if (Id > 0) { //int id = laboService.GetLaboratoires().Take(1).FirstOrDefault().ID; LABORATOIRE User = laboService.GetLaboratoire(Id); bool IsDeleted = laboService.Supprimer(User); return(Request.CreateResponse(HttpStatusCode.OK, IsDeleted)); } else { return(Request.CreateResponse(HttpStatusCode.OK, false)); } } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.BadRequest, ex)); } }
public bool Supprimer(LABORATOIRE iLabo) { return(laboService.Supprimer(iLabo)); }
public bool Modifier(LABORATOIRE iLabo) { return(laboService.Modifier(iLabo)); }
public bool Ajouter(LABORATOIRE iLabo) { return(laboService.Ajouter(iLabo)); }