Exemple #1
0
        public static List <VinylDTO> MapVinylList(List <Vinyl> vinyls)
        {
            List <VinylDTO> vinylsDTO = new List <VinylDTO>();

            foreach (Vinyl vinyl in vinyls)
            {
                VinylDTO newVinylDTO = Map(vinyl);
                vinylsDTO.Add(newVinylDTO);
            }

            return(vinylsDTO);
        }
Exemple #2
0
        public static VinylDTO Map(Vinyl vinyl)
        {
            VinylDTO vinylDTO = new VinylDTO()
            {
                ID      = vinyl.ID,
                Title   = vinyl.Title,
                Band    = vinyl.Band,
                Price   = vinyl.Price,
                inStock = vinyl.InStock
            };

            return(vinylDTO);
        }
        public bool RemoveVinyl(VinylDTO vinylToRemove)
        {
            bool retVal = false;

            try
            {
                retVal = vinylsDataBase.Remove(vinylToRemove.ID);
            }
            catch
            {
                return(false);
            }

            OnRefreshVinyls?.Invoke();
            return(retVal);
        }
Exemple #4
0
 public static IVinyl Map(VinylDTO vinyl)
 {
     return(new Vinyl(vinyl.ID, vinyl.Title, vinyl.Band, vinyl.Price, vinyl.inStock));
 }
 public async Task Unsubscribe(VinylDTO vinyl)
 {
     await vinylsDataBase.Unsubscribe(DTOMapper.Map(vinyl));
 }
 public bool AddVinyl(VinylDTO newVinyl)
 {
     vinylsDataBase.Add(DTOMapper.Map(newVinyl));
     OnRefreshVinyls?.Invoke();
     return(true);
 }