Dapper修改

//商品详情
[HttpGet]
public Goods GetGood(Goods goods)
{
using (SqlConnection conn = new SqlConnection(connstr))
{
return conn.Query<Goods>("select * from Goods where GId=@GId", goods).SingleOrDefault();
}
}
//删除商品
[HttpPost]
public int DeleteGood(Goods goods)
{
using (SqlConnection conn = new SqlConnection(connstr))
{
return conn.Execute("delete from Goods where GId=@GId", goods);
}
}
//修改商品
[HttpPost]
public int UpdateGood(Goods goods)
{
using (SqlConnection conn = new SqlConnection(connstr))
{
return conn.Execute("update Goods set GName=@GName,GColor=@GColor,GSize=@GSize,GPrice=@GPrice where GId=@GId", goods);
}
}

 

//MVC视图

var id = document.cookie;

posted @ 2020-08-06 21:36  影子少年  阅读(161)  评论(0)    收藏  举报