public ActionResult PurchaseList(string companyId, string branchId, string dateFrom, string dateTo, string supplierId) { try { if (!string.IsNullOrEmpty(dateFrom)) { DateTime?dfrom = Convert.ToDateTime(dateFrom); dfrom = new DateTime(dfrom.Value.Year, dfrom.Value.Month, dfrom.Value.Day, 0, 0, 0); dateFrom = dfrom.Value.ToString(CultureInfo.InvariantCulture); } if (!string.IsNullOrEmpty(dateTo)) { DateTime?dto = Convert.ToDateTime(dateTo); dto = new DateTime(dto.Value.Year, dto.Value.Month, dto.Value.Day, 23, 59, 59); dateTo = dto.Value.ToString(CultureInfo.InvariantCulture); } IEnumerable <SuperShopPurchaseDetailViewModel> purchaseDetails = new List <SuperShopPurchaseDetailViewModel>(); if (!string.IsNullOrEmpty(companyId)) { purchaseDetails = Mapper.Map <IEnumerable <SuperShopPurchaseDetailViewModel> >(_rawSqlService.GetAllPurchaseDetail(companyId, branchId, dateFrom, dateTo, supplierId)); } return(View(purchaseDetails)); } catch (Exception ex) { return(JavaScript($"ShowResult('{ex.Message}','failure')")); } }