Exemple #1
0
        public ActionResult <Fiche> Create(FicheDomain fiche)
        {
            var convert = mapper.Map <Fiche>(fiche);

            context.Fiches.Add(convert);
            return(Ok(context.SaveChanges()));
        }
Exemple #2
0
        public ActionResult Put([FromBody] FicheDomain fiche)
        {
            //Récupération de la fiche existante:
            var toModify = context.Fiches
                           .First(f => f.IdFiche == fiche.IdFiche);

            // fiche.IdFiche = toModify.IdFiche;
            //Changement pour update
            mapper.Map <FicheDomain, Fiche>(fiche, toModify);
            //*******************************
            return(Ok(context.SaveChanges()));



            return(NotFound());
        }