public JsonResult SalesInvoiceFoodMenuListByDate(string fromDate, string toDate, int customerId, int storeId) { List <SalesInvoiceViewModel> purchaseViewModels = new List <SalesInvoiceViewModel>(); DateTime newFromDate, newToDate; if (fromDate != null) { newFromDate = fromDate == "01/01/0001" ? DateTime.Now : Convert.ToDateTime(fromDate); newToDate = toDate == "01/01/0001" ? DateTime.Now : Convert.ToDateTime(toDate); } else { newFromDate = DateTime.UtcNow.AddMinutes(LoginInfo.Timeoffset); newToDate = DateTime.UtcNow.AddMinutes(LoginInfo.Timeoffset); } purchaseViewModels = _iSalesInvoiceService.PurchaseInvoiceFoodMenuListByDate(newFromDate.ToString("dd/MM/yyyy"), newToDate.ToString("dd/MM/yyyy"), customerId, storeId).ToList(); return(Json(new { salesInvoiceFoodMenu = purchaseViewModels })); }