public IHttpActionResult GetBillDetail(int id) { MvcBillModel billModel = new MvcBillModel(); billModel = db.BillTables.Where(q => q.BilID == id).Select(c => new MvcBillModel { BilID = c.BilID, Bill_ID = c.Bill_ID, BillDate = c.BillDate, BillDueDate = c.BillDueDate, RefNumber = c.RefNumber, SubTotal = c.SubTotal, TotalVat6 = c.TotalVat6, TotalVat21 = c.TotalVat21, DiscountAmount = c.DiscountAmount, TotalAmount = c.TotalAmount, CustomerNote = c.CustomerNote, Status = c.Status, UserId = c.UserId, CompanyId = c.CompanyId, VenderId = c.VenderId, Type = c.Type, }).FirstOrDefault(); if (billModel == null) { return(NotFound()); } return(Ok(billModel)); }
public IHttpActionResult GetbillIdbyPurchaseId(int Id) { try { MvcBillModel _BillDetailModel = new MvcBillModel(); _BillDetailModel.BilID = db.BillTables.Where(I => I.PurchaseId == Id).FirstOrDefault().BilID; return(Ok(_BillDetailModel)); } catch (Exception) { NotFound(); throw; } }
public IHttpActionResult GetBillNumber() { MvcBillModel _billModel = new MvcBillModel(); int biId = db.BillTables.ToList().Count() + 1; _billModel.Bill_ID = biId.ToString(); if (biId == 0) { return(Ok(_billModel)); } else { return(Ok(_billModel)); } }