public static Basket Convert(BasketDTO basket) { if (basket == null) { throw new ArgumentNullException(nameof(basket)); } return(new Basket { Id = basket.Id, UserId = basket.User.Id, BasketItems = BasketItemsConverter.Convert(basket.BasketItems), User = UserConverter.Convert(basket.User) }); }
public static BasketDTO Convert(Basket basket) { if (basket == null) { throw new ArgumentNullException(nameof(basket)); } var dto = new BasketDTO { Id = basket.Id, User = UserConverter.Convert(basket.User) }; if (basket.BasketItems != null) { dto.BasketItems = BasketItemsConverter.Convert(basket.BasketItems); } return(dto); }