Just I am looking for to replace the JsonResult method into IAction in the code given below
Javascript function GetClockList() { try { var table = $('#tblData').DataTable(); table.destroy(); } catch (ex) { } var table= $('#tblData').DataTable({"ajax": {"url": "/Home/GetClockList?employeeid=" + $('#dropdownEmployee').val()+ "&clockdate=" + $('#txtAttendanceDate').val() ,"type": "GET","datatype": "json","dataSrc": function (json) { return JSON.parse(json); } },"columns": [ { "data": 'ID', "width": "6%" }, { "data": 'EmployeeName', "width": "20%" }, { "data": 'ClockedDatetoList', "width": "20%" }, ], "language": {"emptyTable": "no data found." },"width": "100%" }); }
Controller -- Here how can I replace JsonResult with public IAction method public JsonResult GetClockList(int employeeid,string clockdate) // Is it possible replace JsonResult with IActionResult, If so please how can I { DateTime _clockdate = Convert.ToDateTime(clockdate); ICollection<EsslLog> EsslLog = new List<EsslLog>(); EsslLog = _unitOfWork.EsslLogRepo.GetClockList(employeeid.ToString(), _clockdate); String jsonResult = JsonConvert.SerializeObject(EsslLog); return Json(jsonResult); } Repository public ICollection<EmpLog> GetClockList(string empcode, DateTime datefrom) { ICollection<EmpLog> data = new List<EmpLog>(); data = (from log in ctx.EsslLogs join emp in ctx.goEmployee on log.EmpCode equals emp.EmployeeID.ToString() where log.EmpCode==empcode&& log.DateWithoutTime == datefrom select new EsslLog { ID = log.ID, EmpCode = emp.EmployeeID.ToString(), EmployeeName=emp.EmployeeName, ClockedDate = log.ClockedDate, ClockedDatetoList = log.ClockedDate.Value.ToString("dd/MM/yyyy HH:mm:ss") } ).ToList(); return data; }