示例#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);
        }
示例#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);
        }
示例#3
0
        public bool RemoveVinyl(VinylDTO vinylToRemove)
        {
            bool retVal = false;

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

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