public IDataResult <CartDtoForPage> GetList() { var result = _cartDal.GetCartProducts(); if (result.Count == 0) { return(new ErrorDataResult <CartDtoForPage>(Messages.CartProductNotExists)); } return(new SuccessDataResult <CartDtoForPage>(new CartDtoForPage { Cart = result, TotalPrice = result.Select(x => x.ProductTotalPrice).Sum(x => x) })); }