c# - Efficient Way for Finding Reference Object in LINQ to SQL -


I have a payment system as shown below. Payment can be done through many gift coupons. Gift coupons are issued with a purchase. Customers can use this gift coupon for future purchases. If the payment is made through the gift coupon, the UsedForPaymentID column in the gift coupon table will be updated with that payment ID (for GiftCooping ID). PaidID Gift is a foreign key in the coupon table.

I need to write a method:

  Public DateTime GetPaymentDate (Int Gift Coupon ID)  

This gift gift coupon The date will be used.

To achieve this, I can follow the following steps:

  1. GiftCoos ID (from Gift Coupon Repository) using Gift Coupon Objects
  2. Get the Payment ID from Gift Coupon Object Store in PDF Variables

  3. Paid Pay the object. > Is this an easy / efficient way to do SQL from LINQ?

    Enter image details here

< Div class = "post-text" itemprop = "text">

  var c = context.GiftCoupons.FirstOrDefault (gc = & gt; gcgiftcounces id == giftcocon idid;); If (c! = Null & amp; amp; amp; amp; amp; payment! = Zero] return c.Payment.PaymentDate  

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -