• 6 地址管理 UI C


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;

    namespace LC.UI.Controllers
    {
    using Entity;
    using Newtonsoft.Json;
    public class AddressesController : Controller
    {
    // GET: Addresses
    public ActionResult Index()
    {
    return View();
    }
    /// <summary>
    /// 新增
    /// </summary>
    /// <param name="a"></param>
    /// <returns></returns>
    [HttpPost]
    public int Add(Addresses a)
    {
    var json = Client.GetApi("post","Add",a);
    var result = Convert.ToInt32(json);
    return result;
    }

    /// <summary>
    /// 修改
    /// </summary>
    /// <param name="a"></param>
    /// <returns></returns>
    [HttpPost]
    public int Update(Addresses a)
    {
    var json = Client.GetApi("post", "Update", a);
    var result = Convert.ToInt32(json);
    return result;
    }

    /// <summary>
    /// 删除
    /// </summary>
    /// <param name="Id"></param>
    /// <returns></returns>
    [HttpPost]
    public int Delete(int Id)
    {
    var json = Client.GetApi("post", "Delete?Id="+Id);
    var result = Convert.ToInt32(json);
    return result;
    }

    /// <summary>
    /// 根据Id获取
    /// </summary>
    /// <param name="Id"></param>
    /// <returns></returns>
    [HttpPost]
    public string QueryById(int Id)
    {
    var json = Client.GetApi("post", "QueryById?Id=" + Id);
    var result =JsonConvert.DeserializeObject<Addresses>(json);
    return JsonConvert.SerializeObject(result);
    }

    /// <summary>
    /// 获取数据
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    public string Query()
    {
    var json = Client.GetApi("post", "Query");
    var result = JsonConvert.DeserializeObject<List<Addresses>>(json);
    return JsonConvert.SerializeObject(result);
    }

    /// <summary>
    /// 获取数据
    /// </summary>
    /// <returns></returns>
    [HttpPost]
    public string GetRegion(int PId)
    {
    var json = Client.GetApi("post", "GetRegion?PId="+PId);
    var result = JsonConvert.DeserializeObject<List<Region>>(json);
    return JsonConvert.SerializeObject(result);
    }
    }
    }

  • 相关阅读:
    内存溢出和内存泄漏的区别、产生原因以及解决方案
    HTTP1.0、HTTP1.1 和 HTTP2.0 的区别
    TCP, UDP, HTTP, HTTPS协议
    测试面试常见面试题汇总
    SDK测试方法
    App弱网测试工具--Qnet
    PerfDog性能狗移动端性能测试工具
    Jmeter作用域
    事务(转账功能)
    DBUtils
  • 原文地址:https://www.cnblogs.com/hianb/p/10145732.html
Copyright © 2020-2023  润新知