public IActionResult Detail([FromBody] SearcBySlug request) { var response = new BaseResponse <RecipeFocusedResponse>(); response.Data = new RecipeFocusedResponse(); if (!recipeRepo.Any(x => x.Slug == request.Slug)) { return(NotFound()); } response.Data = recipeRepo.GetBy(x => x.Slug == request.Slug).Select(x => new RecipeFocusedResponse { Id = x.Id, Title = x.Title, Calories = x.Calories, CookingTime = x.CookingTime, Details = x.Details, Images = (x.Images.Any(y => y.RecordStatus == RecordStatus.Active) ? x.Images.Where(y => y.RecordStatus == RecordStatus.Active).Select(y => new ImageMMM { Id = y.Id, Image = y.Image }).ToList() : new List <ImageMMM>()), Ingredients = (x.Ingredients.Any(y => y.RecordStatus == RecordStatus.Active) ? x.Ingredients.Where(y => y.RecordStatus == RecordStatus.Active).Select(y => new IngredientMMM { Id = y.Id, Title = y.Title }).ToList() : new List <IngredientMMM>()), Steps = (x.Steps.Any(y => y.RecordStatus == RecordStatus.Active) ? x.Steps.Where(y => y.RecordStatus == RecordStatus.Active).Select(y => new StepMMMM { Id = y.Id, Title = y.Title }).ToList() : new List <StepMMMM>()), CategoryInfo = x.RecipeCategories.Select(y => new CategoryMMM { Title = y.Category.Title, Slug = y.Category.Slug }).ToList(), PrepareTime = x.PrepareTime, ServiceCount = x.ServiceCount, Slug = x.Slug, UserID = x.UserID, VideoLink = x.VideoLink, Username = x.User.Username, CreateDate = x.CreateDate, AvarageRate = x.Rates.Any(y => y.RecipeID == x.Id) ? x.Rates.Average(y => y.Rate) : 0 }).ToList().FirstOrDefault(); return(Ok(response)); }