//public AuditHistoryApi() //{ // var i = 0; // i++; //} #endregion #region IAuditHistoryApi Implementation /// <summary> /// This retrieves the most recent audit history record. /// </summary> /// <param name="lidType"></param> /// <param name="lid"></param> /// <param name="actionType"></param> /// <returns></returns> public async Task <AuditHistoryModel> GetLatestAuditHistoryRecordAsync(LidTypeEnum lidType, int lid, ActionTypeEnum actionType) { AuditHistoryModel response = null; var auditRecords = await this._auditHistoryRepository .GetAuditHistoryAsync(lidType, lid, actionType); if (null != auditRecords) { var auditList = new List <AuditHistoryModel>(auditRecords); if (auditList.Count > 0) { auditList = auditList .OrderByDescending(currentItem => currentItem.ActionDate) .ToList(); response = auditList[0]; } } return(response); }
public ActionResult Index( DateTime?startDate, DateTime?endDate, string costCode, Guid?activityGroupId, DataTableParamModel request) { var today = DateTime.Today; startDate = startDate ?? new DateTime(today.Year, today.Month, 1); endDate = endDate ?? startDate.Value.AddMonths(1).AddDays(-1); costCode = costCode ?? Settings.Default.RootCostCentre; var model = new AuditHistoryModel { ActivityGroupId = activityGroupId, CostCode = costCode, StartDate = startDate.Value, EndDate = endDate.Value }; return(View(model)); }