private void GetDataBasedOnUserType(vmDashBoard objDashboard, System.Collections.Generic.IList <BatchModel> batch, UserType CurrentUserType, string CurrentUserEmail) { if (CurrentUserType == UserType.Trainer) { objDashboard.BatchList = batch; var LastBatchID = batch.LastOrDefault().Id; var IndList = _Inductee.Get(20, 0); objDashboard.InducteeList = IndList.Where(i => i.BatchID == LastBatchID).OrderByDescending(i => i.Batch.BatchDates.OrderBy(f => f.BatchDate).First()).ToList(); } else if (CurrentUserType == UserType.Trainee) { var inducteeBatchId = _Inductee.Get(CurrentUserEmail).BatchID; var traineesBatch = batch.Where(B => B.Id == inducteeBatchId).Select(B => B).ToList <BatchModel>(); if (traineesBatch.Any()) { objDashboard.BatchList = traineesBatch; var IndList = _Inductee.Get(20, 0); objDashboard.InducteeList = IndList.Where(i => i.BatchID == inducteeBatchId).OrderByDescending(i => i.Id).ToList(); } } }