有关 C# WebAPI知识
1、【
懒得安分博客总结的很全面】
2、关于基础类型作入参数的问题
参照此博客【ASP.NET WebAPI String 传值问题】
3、代码说明
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using PosWebAPi.Models;
using Newtonsoft.Json; namespace PosWebAPi.Controllers
{/// <summary>
///
/// </summary>
public class PosController : ApiController
{
/// <summary>
/// 测试
/// </summary>
/// <returns></returns>
[HttpGet] public string Test()
{
return "Hello Word";
}
/// <summary>
/// 总接口
/// </summary>
/// <param name="sInput"></param>
/// <returns></returns>
[HttpPost]
public Result<object> ProcCYZZSY(string sInput)
{ return WorkServices.PosService._ProcCYZZSY(sInput);
}
[HttpPost] public Result<object> Amt(string sInput)
{ // var s= JsonConvert.SerializeObject(sInput);
//var str = Convert.ToString(sInput); // Posinput pos = new Posinput(); // JsonConvert.DeserializeObject(sInput); return new Result<object>(true,"OK", sInput);
// return WorkServices.PosService._Amt(sInput);
}
[HttpPost]
public Result<object> Amt22(Msg msg)
{ return new Result<object>(true, "", msg.msg1);
} public class Msg
{
public string msg1 { get; set; }
}
}
}


有关 C# WebAPI知识的更多相关文章
- VS Code WebApi系列——2、jwt结合数据库校验
Knowledge should be shared free. 我们都知道WebApi最重要的作用就是为外部服务提供相应的数据接口和服务,所以一般WebApi都会连接后台数据库,那么最重要的一件事就 ...
- WebAPI前置知识:HTTP与RestfulAPI
对HTTP协议的基本了解是能理解并使用RestFul风格API的基础,在了解了这些基础之后,使用各种RestFul的开发框架才能得心应手.我一开始使用WebApi的时候就因为对这些知识缺乏了解,觉得用 ...
- WebApi系列知识总结
WebApi系列知识 一.webApi项目搭建 1.新建WebApi项目 (1) (2) (3) (4) Areas – HelpPage – App_Start – HelpPageConfig.c ...
- ASP.NET Core 2.2 基础知识(十三) WebAPI 概述
我们先创建一个 WebAPI 项目,看看官方给的模板到底有哪些东西 官方给出的模板: [Route("api/[controller]")] [ApiController] pub ...
- webapi相关知识
1.从uri中获取参数 :后端:[FromUri] 2.从uri中获取数组参数:后端:[FromUri]string[] type 前端:type[]=1&type[]=2&type ...
- WebAPI 小知识
1.HttpResponseMessage.ReasonPhrase可以返回原因说明短语, 用JQuery中的$.ajax调用,返回函数第三个参数可以获取,如下: success:function(d ...
- ASP.NET Core 2.2 基础知识(十四) WebAPI Action返回类型(未完待续)
要啥自行车,直接看手表 //返回基元类型 public string Get() { return "hello world"; } //返回复杂类型 public Person ...
- Asp.Net WebApi核心对象解析(下篇)
在接着写Asp.Net WebApi核心对象解析(下篇)之前,还是一如既往的扯扯淡,元旦刚过,整个人还是处于晕的状态,一大早就来处理系统BUG,简直是坑爹(好在没让我元旦赶过来该BUG),队友挖的坑, ...
- ASP.NET MVC5+EF6+EasyUI 后台管理系统(66)-MVC WebApi 用户验证 (2)
系列目录 前言: 回顾上一节,我们利用webapi简单的登录并进行了同域访问与跨域访问来获得Token,您可以跳转到上一节下载代码来一起动手. 继续上一篇的文章,我们接下来演示利用拿到的Token来访 ...
随机推荐
- webpack打包时删除console.log,和debugger
开发过程中我们不可避免的需要console.log调试,然而在上线时如果不删除这些console.log可能会造成内存泄漏,因为console.log出来的变量是不会被GC的,webpack给我们提供 ...
- HTML form表单中action的正确写法
我的Java Web Application的context是myweb,即http://localhost:8080/myweb/index.jsp是欢迎页. 现在我的一个Controller的映射 ...
- DataTime.Now.Ticks
getTime public long getTime() 返回自 1970 年 1 月 1 日 00:00:00 GMT 以来此 Date 对象表示的毫秒数. 返回: 自 1970 年 1 月 1 ...
- 怎样获取所有的script节点
1. 使用document.scripts; document.scripts instanceof HTMLCollection; // true 2. 使用 document.getElement ...
- eclipse 创建聚合maven项目(转)
转自https://blog.csdn.net/u013239111/article/details/76560167 以前我们搭建项目时,通常是吧pojo.dao.service.配置文件等都放在一 ...
- StoneTab标签页CAD插件 3.1.0
//////////////////////////////////////////////////////////////////////////////////////////////////// ...
- SpringBoot-JPA入门
SpringBoot-JPA入门 JPA就是Spring集成了hibernate感觉. 注解,方法仓库(顾名思义的方法,封装好了,还有自定义的方法). 案例: spring: datasource: ...
- (十四)Android NDK混淆
1.ollvm下载编译 我的是macbook环境. 参考obfuscator官网:https://github.com/obfuscator-llvm/obfuscator/wiki 执行下面的命令下 ...
- kubernetes之Taints污点和Tolerations容忍
介绍说明 nodeaffinity节点亲和性是pod上定义的一种属性, 使得pod能够被调度到某些node上运行, taint污点正好相反, 它让node拒绝pod运行, 除非pod明确声明能够容忍这 ...
- docker HealthCheck健康检查
需求 最近遇到的问题:线上跑的一个 Node 镜像是在运行的,状态为 up ,但是访问报 502 ,重启镜像无效,重新拉了个镜像运行才恢复正常.于是想研究下如何从应用层面去检查容器的状态 为什么 do ...