public CheckoutListDto(CheckoutList checkoutList) { CheckoutListId = checkoutList.CheckoutListId; UserId = checkoutList.UserId; //TotalPrice = checkoutList.TotalPrice; CheckoutItems = new List<CheckoutItemDto>(); foreach (CheckoutItem item in checkoutList.CheckoutItems) { CheckoutItems.Add(new CheckoutItemDto(item)); } }
public CheckoutList ToEntity() { CheckoutList checkOutList = new CheckoutList { CheckoutListId = CheckoutListId, UserId = UserId, //TotalPrice = TotalPrice, CheckoutItems = new List<CheckoutItem>() }; foreach (CheckoutItemDto item in CheckoutItems) { checkOutList.CheckoutItems.Add(item.ToEntity()); } return checkOutList; }