Exemple #1
0
        //   [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));
            }
        }
Exemple #2
0
 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));
     }
 }
Exemple #3
0
 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));
     }
 }
Exemple #4
0
 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));
     }
 }
Exemple #5
0
 public bool Supprimer(LABORATOIRE iLabo)
 {
     return(laboService.Supprimer(iLabo));
 }
Exemple #6
0
 public bool Modifier(LABORATOIRE iLabo)
 {
     return(laboService.Modifier(iLabo));
 }
Exemple #7
0
 public bool Ajouter(LABORATOIRE iLabo)
 {
     return(laboService.Ajouter(iLabo));
 }