tags:

views:

37

answers:

1

I currently have two routes configured:


  ResourceSpace.Has.ResourcesOfType()
                  .AtUri("/patient")
                  .And
                  .AtUri("/patient/cardId/{cardId}")
                  .HandledBy()
                  .AsJsonDataContract()
                  .And
                  .RenderedByAspx("~/Views/Patient.aspx");


                ResourceSpace.Has.ResourcesOfType()
                    .AtUri("/product")
                    .And
                    .AtUri("/product/tagValue/{tagValue}")
                    .HandledBy()
                    .AsJsonDataContract()
                    .And
                    .RenderedByAspx("~/Views/Product.aspx");

When using this code


 using (scope(Xhtml.Form(Resource).ID("AddPatientForm").Method("post"))) { 

For patient it translate the action to

action="/patient"

and for product

action="/product/tagValue"

What am I doing wrong? Can I hint it, I had a quick look in the source and Action is a URI so I can't just set it via Action.

Any help would be appreciated!

A: 

For patient, if the Resource has a cardId it should select that URI first. If it doesn't, it's a bug.

For product, that's definitly a bug (unless your product class has a tagValue of null / empty) so please fill a bug report on the new bug tracker at http://youtrack.codebetter.com/issues/OR

In the meantime, you can simply do Xhtml.Form().Action(Resource.CreateUri()) if it has the properties set or Xhtml.Form().Action(Resource.CreateUri(new{ cardId = value });

serialseb
Well that's not really what I'm wanting I don't think Seb, I had another look through the source.TemplatedUriResolver.FindBestMatchingTemplateIt comes back with both my URI's for product, product/tagValue and product, and choose FirstOrDefault, but for Patient only comes back with patient.I figured out why, not sure I've misunderstood, (probably), for my ProductResource I had a property called TagValue, so that method picked it up, when creating the form, but for PatientResource it wasn't called CardId, so it didn't pick it up.I've changed the property names now.
Sarkie