• 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);
    }
    }
    }

  • 相关阅读:
    LeetCode题解之Leaf-Similar Trees
    LeetCode题解之 Increasing Order Search Tree
    建立git仓库的步骤
    Jquery-1(基础)
    JavaScript-12(脚本化CSS)
    JavaScript-11(DOM文档对象模型)
    JavaScript-10(JavaScript事件)
    JavaScript-实现下拉菜单
    JavaScript-9(BOM浏览器对象模型)
    JavaScript-字符与编码转换
  • 原文地址:https://www.cnblogs.com/hianb/p/10145732.html
Copyright © 2020-2023  润新知