public ShoppingCategoryListDto(ShoppingCategoryList shoppingCategoryList) { ShoppingCategoryListId = shoppingCategoryList.ShoppingCategoryListId; UserId = shoppingCategoryList.UserId; Title = shoppingCategoryList.Title; ShoppingItems = new List<ShoppingItemDto>(); foreach (ShoppingItem item in shoppingCategoryList.ShoppingItems) { ShoppingItems.Add(new ShoppingItemDto(item)); } }
public ShoppingCategoryList ToEntity() { ShoppingCategoryList shoppingItem = new ShoppingCategoryList { Title = Title, ShoppingCategoryListId = ShoppingCategoryListId, UserId = UserId, ShoppingItems = new List<ShoppingItem>() }; foreach (ShoppingItemDto item in ShoppingItems) { shoppingItem.ShoppingItems.Add(item.ToEntity()); } return shoppingItem; }