Ejemplo n.º 1
0
        public async Task <IActionResult> GetCountWiseTutorReport(JQueryDataTableParamModel param, TutorFilterLessionWiseAnswerDto model)
        {
            using (var txscope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
            {
                try
                {
                    var parameters = CommonMethod.GetJQueryDatatableParamList(param, GetSortingColumnName(param.iSortCol_0));

                    parameters.Parameters.Insert(0, new SqlParameter("@Fromdate", SqlDbType.DateTime)
                    {
                        Value = Convert.ToDateTime(model.FromDate).ToString("yyyy/MM/dd")
                    });
                    parameters.Parameters.Insert(1, new SqlParameter("@Todate", SqlDbType.DateTime)
                    {
                        Value = Convert.ToDateTime(model.ToDate).ToString("yyyy/MM/dd")
                    });
                    parameters.Parameters.Insert(2, new SqlParameter("@TutorId", SqlDbType.Int)
                    {
                        Value = model.Tid
                    });



                    var allList = await _tutorService.GetCountWiseTutorReport(parameters.Parameters.ToArray());

                    var total = allList.FirstOrDefault()?.TotalRecords ?? 0;
                    return(Json(new
                    {
                        param.sEcho,
                        iTotalRecords = total,
                        iTotalDisplayRecords = total,
                        aaData = allList
                    }));
                }
                catch (Exception ex)
                {
                    ErrorLog.AddErrorLog(ex, "GetFilterTutorReport");
                    return(Json(new
                    {
                        param.sEcho,
                        iTotalRecords = 0,
                        iTotalDisplayRecords = 0,
                        aaData = ""
                    }));
                }
            }
        }