Выходные параметры не удалось получить из веб-API в angular 4
Here I am trying to post some data to DB and at the time my WebApi is accepting the value from angular and to passing data to DB, the data successfully saved. but my problem is at the saving time my Stored procedure is passing an out parameter to WEB API, Then how can i get the out parameter from WebAPI to my angular 4 app? and am new in angular and web API so in my question have any problem please pardon me
Что я уже пробовал:
MY SQL Code is CREATE PROCEDURE storedprocedurename (@....., @...., @...., @Schid int, @TransactionId int OUTPUT ) ................. ................ set @TransactionId= @Schid insert into tbl name(.....) (@....., @.....) My API is public class StockcountheaderController : ApiController { private adminv2Entities enqentities = new adminv2Entities(); HttpSessionState session = HttpContext.Current.Session; [HttpPost] public 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; if (TransactionId.Value != null) { session["myTransID"] = (int)TransactionId.Value; } enqentities.spGetNewStockCountHeader(Datastock.UserID, Datastock.created, Datastock.CompanyID, Datastock.modified, Datastock.modifieduserid, Datastock.confirm, Datastock.ShopId, TransactionId); } } Typescript file is TransactionId:number=1; this.header = new IHeaderstock(this.userid, this.created, this.CompanyID, this.modified, this.modifieduserid, this.confirm, this.shopid,this.TransactionId); this.headeritems.push(this.header); onClick() { this._enqService.CatchHeaderDetail(this.headeritems) .subscribe(value => { if (typeof value !== 'undefined' && value != null) { value.forEach(header => { this.headeritems.push(this.header) }); } }, error => { console.error(error); this.statusMessage = "Problem with the service.Please try again after sometime"; }); And my service.ts is CatchHeaderDetail(stock: any) : Observable<IHeaderstock[]> { let stockheaderdetail = stock; console.log(stockheaderdetail) let headers = new Headers({ 'Content-Type': 'application/json' }); let options = new RequestOptions({ headers: headers }); return this._http.post('http://localhost:3031/api/Stockcountheader/' + 'Stock', stockheaderdetail, options) .map((response: Response) => <IHeaderstock[]>response.json()) .catch(this.handleError); }
Gerry Schmitz
Выяснили ли вы, что вы хотите сделать с этим "out параметром" в вашем "angular 4 app"?