Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

My Primary Key is returning 0

$
0
0
<div class="container _full "> <div class="snippet-hidden" id="content"> <div itemtype="http://schema.org/Question" itemscope=""> <div class="inner-content clearfix"> <div id="mainbar" role="main" aria-label="question and answers"> <div class="question" id="question" data-questionid="49238061"> <div class="post-layout"> <div class="postcell post-layout--right"> <div class="post-text" itemprop="text">

hi guys

I am trying to get the value of the primary key of my model

However I get 0

My code is

 if (ModelState.IsValid)
                {
                    context.Upload_Transaction.Add(upload_Transaction);
                    await context.SaveChangesAsync();

                    id = Upload_Transaction.Upload_TransactionID; 
                    ViewData["id"] = id; // For some reason this returns 0

                }

</div> </div> </div> </div> </div> </div> </div> </div> </div>

Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>