第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何在 WebAPI 的控制器中傳遞輸出參數(shù)

如何在 WebAPI 的控制器中傳遞輸出參數(shù)

C#
幕布斯7119047 2023-09-16 15:02:58
這里我從存儲(chǔ)過程中檢索輸出參數(shù)Entity Framework(EDMX)(輸出參數(shù)是TransactionId)這里我想將TransactionId值傳輸?shù)絊cdid(在下一篇文章方法中)如何獲取TransactionId = Scdid in the controller我的API代碼是 public class StockcountheaderController : ApiController{    private adminv2Entities enqentities = new adminv2Entities();    [HttpPost]    private  void Stock([FromBody] List<spGetNewStockCountHeader_Result> jsonvalues)    {        foreach (spGetNewStockCountHeader_Result Datastock in jsonvalues)        {            ObjectParameter TransactionId = new ObjectParameter("TransactionId", typeof(Int32));            spGetNewStockCountHeader_Result Stockobject = new  spGetNewStockCountHeader_Result();            Stockobject.UserID = Datastock.UserID;            Stockobject.created = Datastock.created;            Stockobject.CompanyID = Datastock.CompanyID;            Stockobject.modified = Datastock.modified;            Stockobject.modifieduserid = Datastock.modifieduserid;            Stockobject.confirm = Datastock.confirm;            Stockobject.ShopId = Datastock.ShopId;            enqentities.spGetNewStockCountHeader(Datastock.UserID,  Datastock.created,                 Datastock.CompanyID, Datastock.modified,  Datastock.modifieduserid, Datastock.confirm,                Datastock.ShopId, TransactionId);        }    }    }
查看完整描述

1 回答

?
守著一只汪

TA貢獻(xiàn)1872條經(jīng)驗(yàn) 獲得超4個(gè)贊

對(duì)問題進(jìn)行詳細(xì)討論后,發(fā)現(xiàn)存儲(chǔ)過程未正確返回 OUTPUT 參數(shù)。上述問題的最終解決方案需要修改代碼:


[HttpPost]

private  IActionResult Stock([FromBody] List<spGetNewStockCountHeader_Result> jsonvalues)    

{

  ObjectParameter TransactionId = new ObjectParameter("TransactionId", typeof(Int32));

  foreach (spGetNewStockCountHeader_Result Datastock in jsonvalues)

  {


    spGetNewStockCountHeader_Result Stockobject = new spGetNewStockCountHeader_Result();

    Stockobject.UserID = Datastock.UserID;

    Stockobject.created = Datastock.created;

    Stockobject.CompanyID = Datastock.CompanyID;

    Stockobject.modified = Datastock.modified;

    Stockobject.modifieduserid = Datastock.modifieduserid;

    Stockobject.confirm = Datastock.confirm;

    Stockobject.ShopId = Datastock.ShopId;

    enqentities.spGetNewStockCountHeader(Datastock.UserID, Datastock.created, Datastock.CompanyID, Datastock.modified, Datastock.modifieduserid, Datastock.confirm,Datastock.ShopId, TransactionId);

  }

return Ok(new { data = TransactionId.Value});    

}

在 Angular 應(yīng)用程序中獲取該TransactionId值后,您可以使用該值將其作為查詢字符串或 POST 正文中的參數(shù)發(fā)送到下一個(gè)方法。


查看完整回答
反對(duì) 回復(fù) 2023-09-16
  • 1 回答
  • 0 關(guān)注
  • 135 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)