WPF实战学习笔记14-使用Todo类的GetAll接口

使用Todo类的GetAll接口

添加包:RestSharp(V:110)

删除不再需要的文件

  • Mytodo/Common/TodoDto.cs
  • Mytodo/Common/MemoDto.cs

新建基础类或接口

MyToDo.Share/ApiResponse.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyToDo.Share
{
    public class ApiResponse
    {
        public string? Message { get; set; }

        public bool Status { get; set; }

        public object? Result { get; set; }
    }

    public class ApiResponse<T>
    {
        public string? Message { get; set; }

        public bool Status { get; set; }

        public T? Result { get; set; }
    }
}

MyToDo.Share/IPageList.cs
namespace MyToDo.Share.Contact
{
    using System.Collections.Generic;
    /// <summary>
    /// Provides the interface(s) for paged list of any type.
    /// 为任何类型的分页列表提供接口
    /// </summary>
    /// <typeparam name="T">The type for paging.分页的类型</typeparam>
    public interface IPagedList<T>
    {
        /// <summary>
        /// Gets the index start value.
        /// 获取索引起始值
        /// </summary>
        /// <value>The index start value.</value>
        int IndexFrom { get; }
        /// <summary>
        /// Gets the page index (current).
        /// 获取页索引(当前)
        /// </summary>
        int PageIndex { get; }
        /// <summary>
        /// Gets the page size.
        /// 获取页面大小
        /// </summary>
        int PageSize { get; }
        /// <summary>
        /// Gets the total count of the list of type <typeparamref name="T"/>
        /// 获取类型列表的总计数
        /// </summary>
        int TotalCount { get; }
        /// <summary>
        /// Gets the total pages.
        /// 获取页面总数
        /// </summary>
        int TotalPages { get; }
        /// <summary>
        /// Gets the current page items.
        /// 获取当前页项
        /// </summary>
        IList<T> Items { get; }
        /// <summary>
        /// Gets the has previous page.
        /// 获取前一页
        /// </summary>
        /// <value>The has previous page.</value>
        bool HasPreviousPage { get; }

        /// <summary>
        /// Gets the has next page.
        /// 获取下一页
        /// </summary>
        /// <value>The has next page.</value>
        bool HasNextPage { get; }
    }
}

MyToDo.Share/PageList.cs

新建BaseRequest

新建文件:Mytodo/Service/BaseRequest.cs

using RestSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mytodo.Service
{
    public class BaseRequest
    {
        public Method Method { get; set; }

        public string? Route { get; set; }

        public string ContentType { get; set; } = "application/json";

   
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值