// GET: /Management/SupplierInvestment/GetAllSupplierInvestment public JsonResult GetAllSupplierInvestment(DateObj dateObj) // public JsonResult GetAllSupplierInvestment() { var data = _aManager.GetAllSupplierInvestment(dateObj); return(Json(new { data = data.Data }, JsonRequestBehavior.AllowGet)); }
public ResponseModel GetAllSupplierInvestment(DateObj dateObj) { DateTime fromDate = DateTime.ParseExact(dateObj.FromDate, "dd/MM/yyyy", null); DateTime toDate = DateTime.ParseExact(dateObj.ToDate, "dd/MM/yyyy", null); var allSuppliers = _aSupplierRepository.SelectAll(); //var allSupplierInvestments = _aRepository.SelectAll(); var allSupplierInvestments = _aRepository.SelectAll().Where(a => a.TransactionDate.Date >= fromDate.Date && a.TransactionDate.Date <= toDate.Date); var q = (from c in allSupplierInvestments join dep in allSuppliers on c.SupplierId equals dep.SupplierId into ps from dep in ps.DefaultIfEmpty() select new { c.SupplierInvestmentId, c.SupplierId, SupplierName = dep == null ? "No Supplier" : dep.SupplierName, c.TransactionDate, c.Reason, c.Amount, c.MemberName, c.MemberNid, c.A_GlTransactionId //c.SupplierName }).OrderByDescending(c => c.SupplierInvestmentId); return(_aModel.Respons(q)); }