I am trying to create a background job using hangfire as explained in this article "Background jobs in ASP.NET MVC C# using Hangfire.io" but I don't want to run this background jobs when working locally.
So, How can I check if I am on localhost in C# & ASP.NET MVC and not run this background jobs?
...I am trying to add List.GroupBy(a=>a.ProductType.Name).Select(a=>a.FirstOrDefault())
, now here I can have null values for .ProductType or .name so how can I ignore null values in C#, so I can get proper results of GroupBy?
If I am using above query in C#, I am getting error
Object reference not set to an instance of an object
I tried to make it like List.GroupBy(a=>a.ProductType != null ? a.ProductType)
, but it doesn't work.
When I am trying to save Updated data in table using Entity Framework in ASP.NET MVC, I am getting the below error
...When I am trying to run this command using Entity framework in controller of my project
...