public async Task <IEnumerable <CreateProjectionFilterResultModel> > FilterProjectionsByAuditoriumName(string searchData) { var data = await _projectionsRepository.FilterProjectionsByAuditoriumName(searchData); List <CreateProjectionFilterResultModel> result = new List <CreateProjectionFilterResultModel>(); if (data == null) { result.Add(new CreateProjectionFilterResultModel { IsSuccessful = false, ErrorMessage = Messages.PROJECTION_SEARCH_ERROR }); return(result); } var n = data.Count(); if (data.Count() == 0) { result.Add(new CreateProjectionFilterResultModel { IsSuccessful = true, ErrorMessage = Messages.PROJECTION_SEARCH_NORESULT, Projection = new ProjectionDomainFilterModel { CinemaName = "Cinema not found", AditoriumName = "Auditorium not found", MovieTitle = "Movie not found.", } }); return(result); } List <ProjectionDomainFilterModel> listProjDomMode = new List <ProjectionDomainFilterModel>(); foreach (var item in data) { CreateProjectionFilterResultModel model = new CreateProjectionFilterResultModel { IsSuccessful = true, ErrorMessage = Messages.PROJECTION_SEARCH_SUCCESSFUL, Projection = new ProjectionDomainFilterModel { AditoriumName = item.Auditorium.Name, MovieTitle = item.Movie.Title, ProjectionTime = item.DateTime, CinemaName = item.Auditorium.Cinema.Name } }; result.Add(model); } return(result); }