Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • sai kiran 4 posts 93 karma points
    Feb 24, 2020 @ 01:43
    sai kiran
    0

    Routing or Model binding

    Hi Guys,

    Having trouble in returning to view by passing model along with this.

    errorMessage Cannot bind source type eCaptis.Models.Patient to model type Umbraco.Core.Models.PublishedContent.IPublishedContent.

      public class PatientController : SurfaceController
    {
    
    
        public ActionResult Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Patient patient = db.Patients.Find(id);
            if (patient == null)
            {
                return HttpNotFound();
            }
            return PartialView( patient);
        }
    }
    

    I possibly suspect there is problem with the routing, as after installing Umbraco v8, Debugger is not hitting RouteConfig.cs

    Bit of BackGround: I have created a document type in umbraco called home which has a child item edit and login

    Home page will display a table where by clicking on name it should navigate to edit patient view, so i have passed Id of the patient to controller upon clicking the name of patient as shown in the code above.

    Doing this my url is changing from http://localhost:12345 to http://localhost:12345/umbraco/Surface/Patient/Edit/345

    In general if we dont use surface controller or Umbraco this url could be like http://localhost:12345 to http://localhost:12345/Patient/Edit/345

    I have even looked into route hijacking but this did not help me or may be because of my lack of understanding.

    Any help in fixing this is much appreciated Thanks in advance

Please Sign in or register to post replies

Write your reply to:

Draft