コード例 #1
0
 public static Wholesaler ToModel(this WholesalerEntity entity)
 {
     return(new Wholesaler
     {
         Id = entity.Id,
         Name = entity.Name
     });
 }
コード例 #2
0
        public int CreateWholesaler(WholesalerDTO wholesaler)
        {
            var wholesalerEntity = new WholesalerEntity
            {
                Name    = wholesaler.Name,
                LogoUrl = wholesaler.LogoUrl
            };

            return(_wholesalerRepository.Create(wholesalerEntity));
        }
コード例 #3
0
        private WholesalerDTO ConvertToDTO(WholesalerEntity wholesaler)
        {
            if (wholesaler == null)
            {
                return(null);
            }

            //TODO: Use AutoMapper instead of custom mapping
            return(new WholesalerDTO
            {
                Id = wholesaler.Id,
                Name = wholesaler.Name,
                LogoUrl = wholesaler.LogoUrl
            });
        }