1

I want to store dates in database as Normal Gregorian dates. However, I want to enable user view/edit them in Hijri calendar.

Now I have two problems:

  • Before displaying the date, convert it to Hijri (Done, using DisplayTemplates)
  • After user edit and submit, convert Hijri value to Gregorian. (My problem)

I now can use FormCollection and invoke a helper method to convert the received Hijri to Gregorian, but I am asking if there is some method to automatically convert the value to Gregorian, maybe something IModelBinder ??

FindOut_Quran
  • 728
  • 3
  • 10
  • 27
  • Yes you could use a custom ModelBinder. –  Aug 27 '15 at 13:01
  • @StephenMuecke Can you show me how? – FindOut_Quran Aug 27 '15 at 13:02
  • There are plenty of examples of creating a custom model binder for dates (for example some of the [answers here](http://stackoverflow.com/questions/2356601/custom-datetime-model-binder-in-asp-net-mvc). Have a go, and if your having problems, post what you have tried. –  Aug 27 '15 at 13:08

0 Answers0