Convert #JSON Object from #AngularJS to a Class Instance in #WebApi

Last Tuesday I had a challenging task. Pass a range of dates from AngularJS to WebApi as a single value, and more importantly, the value must be converted as a class instance. It might be simple for some of you but if you are under a bit of stress, it’s not. At first nothing was passing but don’t despair, I found a cure solution. First of all make sure that the Class fields are all objects (Not strings! Strings don’t work. That was the first mistake). Continue reading

Improve Website Performance with Lowercase URLs #SEO

At work we are always seeking how to make our websites use fewer resources and perform better. One of the performance increase was found by having Lowercase URLs. From the testing done, it resulted that Lowercase URLs make an average performance improvement of 10%. A big improvement with minimal effort.

How do you make sure that all the URLs are in lowercase? In MVC ASP.Net, you just need to add 1 line of code.

Continue reading

Convert Enum to KeyValuePair List and remove unwanted Enum options #Linq

In our new project, using Angular, I needed to fill drop down lists in a form from a set of enums. One particular case was to set the below Status Enum as a drop down list.

    public enum Status
        Deactive = 1,
        Active = 2,
        Expired = 3,
        Deleted = 4,

To do that, the best solution I found was to convert the enums to a list KeyValuePair items. How do you do that? Continue reading