1.在Products解决方案文件夹下面新建一个项目 .net Core/Asp.net Core Web应用程序  取名Product.WebApi/选择Web Api core2.0版本 不进行身份验证

2.添加一个控制器(的API控制器)。

3.这个webapi项目只依赖于AppSrv项目,所以添加引用 Product.AppSrv。

4.添加AddProduct接口方法

namespace Product.WebApi.Controllers
{
[Produces("application/json")]
[Route("api/Product")]
public class ProductController : Controller
{
[HttpPost]
[Route("AddProduct")]
public ResultEntity<bool> AddProduct([FromBody] AddProductSPUDto addProductSPUDto)
{
var result = new ResultEntity<bool>();
var productdbcontext =new ProductEFCoreContext();
var irepsotory = new EFCoreRepository(productdbcontext);
var iproductrepsitory = new ProductEFCoreRepository(productdbcontext);
var addproductspuusecase = new AddProductSPUUseCase(irepsotory, iproductrepsitory);
try
{
result = addproductspuusecase.AddProduct(addProductSPUDto);
result.IsSuccess = true;
result.count = ;
result.Msg = "上架产品成功";
}
catch (Exception ex)
{
result.ErrorCode = ;
result.Msg = ex.Message;
}
return result;
} }
}

最新文章

  1. SOUI更新到2.0
  2. 网络地址转换NAT原理及其作用
  3. Spring task executor同异步
  4. mysql null值的特殊处理
  5. PowerDesigner连接MySQL,建立逆向工程图解
  6. angularjs工程流程走不通的原因以及使用angularjs流程注意点
  7. IOS 开发过程中的 消息通知 小红点
  8. CF Theatre Square
  9. Java出现No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing--转
  10. Kendo UI开发教程(27): 移动应用开发简介
  11. LintCode 二叉树的层次遍历 II
  12. PostgreSQL Replication之扩展与BDR
  13. java的poi技术读取和导入Excel实例
  14. hdu 3790 最短路问题 (spfa练手)
  15. python+appium-desktop:安卓(android)7.0以上使用appium无法定位元素(无法refresh)且 无法运行脚本
  16. virtualBox 虚拟机下nginx设置不缓存静态文件不起作用解决办法
  17. wchar_t,char,string,wstring等的总结
  18. 剖析Elasticsearch集群系列之一:Elasticsearch的存储模型和读写操作
  19. RecyclerView 上拉加载下拉刷新
  20. MT【163】运动是相对的

热门文章

  1. client产生CLOSE_WAIT状态的解决方式
  2. 关于重定向RedirectAttributes的用法(转)
  3. win32中SetCapture 和 ReleaseCapture的使用(查一下在VCL中的使用)
  4. css聊天气泡样式
  5. gerrit docker
  6. [JS Compse] 4. A collection of Either examples compared to imperative code
  7. windows server 2012 AD 活动目录部署加入域并创建域用户(寻找视频课程)(计算机加入域其实是本计算机的管理员账号(本机名)加入域,关联账号即可在已经加入域的计算机上面登录)
  8. C++实现简单的内存块自己主动管理
  9. 【前端统计图】hcharts实现堆叠柱形图(与后台数据交互)
  10. 【u215】河床