Route with Dates

25 views
Skip to first unread message

Dave

unread,
Aug 16, 2012, 8:54:14 AM8/16/12
to fubumv...@googlegroups.com
Hi,

I'm trying to get a route with a From and To Dates in it without much success..

Anyway to test this out I've created the following test handler:

public class GetHandler
{
    private readonly IUrlRegistry urlRegistry;

    public GetHandler(IUrlRegistry urlRegistry)
    {
        this.urlRegistry = urlRegistry;
    }

    public string Execute(GetInputModel inputModel)
    {
        return urlRegistry.UrlFor( new ComplexRoute.GetInputModel { Id = 5, FromDate = DateTime.Now, ToDate = DateTime.Now.AddDays( 1 ) } );
    }
}

This returns:

/complex-route/5/16/08/2012%2013%3A53%3A27/17/08/2012%2013%3A53%3A27

Which as you can see contains lots of / (slashes) so when you try and go to that route it won't work.

Is there a better way to work with Dates and routing in fubu?

Sorry for all the questions this week. Basically I'm leaving my current roll and I'm trying to clear up all the issues we've had with fubu, so the current company doesn't abandon it.

Tar

Dave

Jeremy D. Miller

unread,
Aug 16, 2012, 8:56:27 AM8/16/12
to fubumv...@googlegroups.com
DateTime itself is a monster.  How about using a different type to represent a day that just looks better?  Like, say, the Date class in FubuCore?

That'd give you:

/complex-route/ddmmyyyy/ddmmyyyy

Or use your own type that gives you the format you'd want.
 
Jeremy D. Miller
The Shade Tree Developer
jeremy...@yahoo.com



From: Dave <craft...@gmail.com>
To: fubumv...@googlegroups.com
Sent: Thu, August 16, 2012 7:54:17 AM
Subject: [fubumvc] Route with Dates
--
You received this message because you are subscribed to the Google Groups "FubuMVC Development Group" group.
To view this discussion on the web visit https://groups.google.com/d/msg/fubumvc-devel/-/_BTPwpdM2DIJ.
To post to this group, send email to fubumv...@googlegroups.com.
To unsubscribe from this group, send email to fubumvc-deve...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/fubumvc-devel?hl=en.

Dave

unread,
Aug 16, 2012, 9:01:06 AM8/16/12
to fubumv...@googlegroups.com
Magic thank you.. I'll give the Date in fubu core a go :)
Reply all
Reply to author
Forward
0 new messages