public ActionResult <Fiche> Create(FicheDomain fiche) { var convert = mapper.Map <Fiche>(fiche); context.Fiches.Add(convert); return(Ok(context.SaveChanges())); }
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()); }