Copied to clipboard

Flag this post as spam?

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


  • ThomasBrunbjerg 90 posts 182 karma points
    Sep 04, 2017 @ 09:18
    ThomasBrunbjerg
    0

    Using Entity Framework 6.1.3 with custom table in MSSQL Database

    I have implemented EF 6 in my project, since I need to add bookings to a booking table stored in a MSSQL Database. I've done all the steps required to add the EF functionality, but I can't seem to generate a link to my Create view, which is what I need.

    I created the ADO.NET Entity Data Model, which has this structure: https://i.imgur.com/y0oNnWn.png

    And created a controller to scaffold my CRUD views.

    public class BookingsController : Controller {...}

    Now, I have all my views ready, but I can't link to them using normal MVC means.

    I have a button which needs to redirect to the create view. This is what i tried so far:

    <a href='@Url.Action("Index", "Bookings")'><button class="btn_1" type="button">Book dette sommerhus</button></a>
    

    Right now I am just redirecting to the index view for testing purposes, but what is generated in the HTML is just an empty a tag with a nested button. The href attribute isn't even generated.

    I tried creating an action link as well:

    @Html.ActionLink("Bookinger", "Index", "Bookings")
    

    Which just sends me to this URL: http://localhost:49742/umbraco/Surface/Bookings

    And returns a 404 resource not found error.

    What am I doing wrong? Can I not use the standard MVC way to access my views? Do I need to inherit from the Umbraco controllers?

  • ThomasBrunbjerg 90 posts 182 karma points
    Sep 04, 2017 @ 09:30
    ThomasBrunbjerg
    0

    Now my ActionLink somehow started working, but my Url.Action which is the one I want to use, still doesn't generate a link to my desired view.

Please Sign in or register to post replies

Write your reply to:

Draft