BistroDriveWebApp.Models.DishRepository.GetDishByUserId C# (CSharp) Method

GetDishByUserId() public method

public GetDishByUserId ( string Id, int limit ) : IEnumerable
Id string
limit int
return IEnumerable
        public IEnumerable<dish> GetDishByUserId(string Id, int limit = 0)
        {
            IEnumerable<dish> result;
            if (limit == 0)
            {
                result = context.dishes.Where(d => d.Id_User == Id);
            }
            else
            {
                result = context.dishes.Where(d => d.Id_User == Id).Take(limit);
            }
            var dishtypes = GetDishTypes();
            foreach(var item in result)
            {
                item.dishtype = dishtypes.FirstOrDefault(dt => dt.Id_DishType == item.Id_Type);
            }
            return result;
        }