public override Vends Insert(Vends toInsert)
        {
            Dictionary <string, object> Parameters = MapToDico(toInsert);

            base.Insert(Parameters);
            return(toInsert);
        }
        private Dictionary <string, object> MapToDico(Vends toInsert)
        {
            Dictionary <string, object> p = new Dictionary <string, object>();

            p["IdPermaFungi"] = toInsert.IdPermaFungi;
            p["IdProduit"]    = toInsert.IdProduit;
            p["DateVente"]    = toInsert.DateVente;
            return(p);
        }
예제 #3
0
 //create
 public HttpResponseMessage Post([FromBody] Vends vente)
 {
     try
     {
         VendsRepository VenteRepo = new VendsRepository(connexion);
         VenteRepo.Insert(vente);
         return(Request.CreateResponse(HttpStatusCode.Created, vente));
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
예제 #4
0
 //update
 public HttpResponseMessage Put([FromBody] Vends vente)
 {
     try
     {
         VendsRepository VenteRepo = new VendsRepository(connexion);
         if (vente == null)
         {
             return(Request.CreateResponse(HttpStatusCode.NotFound, "Vente Not Found"));
         }
         VenteRepo.Update(vente);
         return(Request.CreateResponse(HttpStatusCode.OK, vente));
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
예제 #5
0
        public void GetOne()
        {
            var Cxt = new VendsRepository(connexion);

            var vente = new Vends
            {
                DateVente    = new DateTime(),
                IdPermaFungi = 1,
                IdProduit    = 2
            };

            CompositeKey <int, int> id = new CompositeKey <int, int> {
                PK1 = 2, PK2 = 2
            };

            Assert.IsNotNull(Cxt.GetOne(id));
        }
        public override bool Update(Vends toUpdate)
        {
            Dictionary <string, object> Parameters = MapToDico(toUpdate);

            return(base.Update(Parameters));
        }