Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem in going to the Customer/Detail page and consuming it #383

Open
MukulSah opened this issue Jul 17, 2023 · 2 comments
Open

Problem in going to the Customer/Detail page and consuming it #383

MukulSah opened this issue Jul 17, 2023 · 2 comments

Comments

@MukulSah
Copy link

i have added the routing
[Route ("Customers/Details/{id}")]
public ActionResult Details(int id)
{
var customer = _context.Customers.SingleOrDefault(c =>c.Id == id);

        if (customer == null)
            return HttpNotFound();
        else
        return View(customer);
    }

still it didnt work also i applied Route.MapRoute(
name: "Details",
url: "{Customers}/{Details}/{id}",
defaults: new { controller = "Customers", action = "Details", id = UrlParameter.Optional }
);

this also didnt worked it is giving the error of Server Error in '/' Application.
The resource cannot be found. and url is something like this http://localhost:50904/Customers/Details?Length=9

when im redirecting it http://localhost:50904/Customers/Details/1 it is giving me the error of Server Error in '/' Application.
The model item passed into the dictionary is of type 'Aura.Models.Customer', but this dictionary requires a model item of type 'Aura.ViewModels.RandomMovieViewModel'.

@1HazArd1
Copy link

The URL has been incorrectly defined. The controller and the action name shouldn't be in the curly bracket "Customers/Details/{id}". The entities that are variable-like parameters are inside curly brackets while the controller and action here are fixed in this case

@MukulSah
Copy link
Author

The URL has been incorrectly defined. The controller and the action name shouldn't be in the curly bracket "Customers/Details/{id}". The entities that are variable-like parameters are inside curly brackets while the controller and action here are fixed in this case

Thnxx bro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants