Click here to Skip to main content
15,896,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
public static void GetByid(long id)
      {
          using (var db = new ClientDbContext(DALContext.LoyaltyGenieWebDbConnectionString))
          {
              List<PromotionCategories> promotioncategories=new List<PromotionCategories>();
              //List<PromotionCategories> promotioncategories = db.PromotionCategories.Where(t => t.PromotionsId == id).ToList();
              var p = (from s in db.PromotionCategories
                       join x in db.QualifyOption on s.Id equals x.PromotionCategoryId
                       into t from cat in t.DefaultIfEmpty()
                       where s.PromotionsId == id
                       select new
                       {
                           s.Id,
                           s.PromotionsId,
                           s.NumberofProducts,
                           s.ActiveStatus,
                           s.CreatedDate,
                           s.ModifiedDate,
                           s.CreatedBy,
                           s.ModifiedBy,
                           s.PromotionCategory,
                           s.CategoryId,
                           s.ProductId,
                           cat.IsOption,
                           cat.OptionId,
                           cat.PromotionCategoryId


                       }).ToList();


          }
      }
.

Please help me.
thank you.

What I have tried:

The cast to value type 'System.Boolean' failed because the materialized value is null. Either the result type's generic parameter or the query must use a nullable type.
Posted
Updated 25-Apr-19 9:45am

1 solution

This is the suggested remedial action for what goes on the left side.

bool? ImNullable = null;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900