public IHttpActionResult GetBillingData(string id) { BillingMasterClass BM = null; using (var ctx = new EasyBillingEntities()) { var pmexits = ctx.Billing_Masters.Select(s => new BillingMasterClass() { Billing_Number = s.Billing_Number }).Where(a => a.Billing_Number == id).Any(); if (pmexits == true) { BM = ctx.Billing_Masters.Select(s => new BillingMasterClass() { Billing_Number = s.Billing_Number, Barcode_Number = s.Barcode_Number }).Where(a => a.Billing_Number == id).FirstOrDefault(); } } if (BM == null) { return(NotFound()); } return(Ok(BM)); }
public IHttpActionResult GetBillinglastId() { BillingMasterClass BM = null; using (var ctx = new EasyBillingEntities()) { var pmexits = ctx.Billing_Masters.Select(s => new BillingMasterClass() { Billing_Number = s.Billing_Number }).Any(); if (pmexits == true) { BM = ctx.Billing_Masters.Select(s => new BillingMasterClass() { Billing_Number = s.Billing_Number }).OrderByDescending(o => o.Billing_Number).FirstOrDefault(); } } if (BM == null) { return(NotFound()); } return(Ok(BM)); }