public ProductOwnerDTO GetById(int id)
        {
            ProductOwnerDTO retour = new ProductOwnerDTO();

            retour = _logic.GetById(id);
            return(retour);
        }
Beispiel #2
0
        public ProductOwnerDTO GetById(int Id)
        {
            ProductOwnerDTO retour = new ProductOwnerDTO();
            ProductOwner    objet  = _repo.Get(Id);

            retour = MapProductOwnerDTO.ToDto(objet);
            return(retour);
        }
Beispiel #3
0
        public ProductOwnerDTO Update(ProductOwnerDTO objet)
        {
            ProductOwner    entite   = MapProductOwner.ToEntity(objet, false);
            ProductOwner    resultat = _repo.Update(entite);
            ProductOwnerDTO retour   = MapProductOwnerDTO.ToDto(resultat);

            return(retour);
        }
        internal static ProductOwnerDTO ToDto(ProductOwner objet)
        {
            ProductOwnerDTO retour = new ProductOwnerDTO();

            if (objet != null)
            {
                retour.Id               = objet.Id;
                retour.LastName         = objet.LastName;
                retour.FirstName        = objet.FirstName;
                retour.FullName         = objet.FirstName + " " + objet.LastName;
                retour.IsDeleted        = objet.IsDeleted;
                retour.DateCreation     = (System.DateTime)objet.DateCreation;
                retour.DateModification = (System.DateTime)objet.DateModification;
            }
            return(retour);
        }
 //modification d'entité avec fourniture de l'Id obligatoire
 public ActionResult <ProductOwnerDTO> Put([FromBody] ProductOwnerDTO objet)
 {
     if (ModelState.IsValid && objet.Id.HasValue)
     {
         try
         {
             ProductOwnerDTO resultat = _logic.Update(objet);
             return(resultat);
         }
         catch
         {
             return(null);
         }
     }
     else
     {
         return(BadRequest("BusinessManagerDTO invalide"));
     }
 }
Beispiel #6
0
        internal static ProductOwner ToEntity(ProductOwnerDTO objet, bool creation)
        {
            ProductOwner retour = new ProductOwner();

            if (objet != null)
            {
                retour.LastName  = objet.LastName;
                retour.FirstName = objet.FirstName;
                if (creation)
                {
                    retour.IsDeleted        = false;
                    retour.DateCreation     = DateTime.UtcNow;
                    retour.DateModification = DateTime.UtcNow;
                }
                else
                {
                    retour.Id               = objet.Id;
                    retour.IsDeleted        = objet.IsDeleted;
                    retour.DateCreation     = objet.DateCreation;
                    retour.DateModification = DateTime.UtcNow;
                }
            }
            return(retour);
        }