none
ASP.NET Core Return class back to controller RRS feed

  • Question

  • Can anyone point me to documentation on how to wrap fields back into a class and return it back to a controller?

    I need to do the following:

    1. I have populated a group of data (i.e. a Ticket) onto a view based on a ticket ID

    2. On the view, the user is able to change the text of the data, then click a button to update the ticket to the new text

    the class looks like this:

        public class zfTicket:TableEntity
        {
            public zfTicket()
            {
                
            }
            public zfTicket(string PartitionKey, string RowKey)
            {
                this.PartitionKey = PartitionKey;
                this.RowKey = RowKey;
            }
            [Key]
            public string TicketId { get; set; }
            public string TicketTitle { get; set; }
            public string TicketCreationDate { get; set; }
            public string AssignedTo { get; set; }
            public string Severity { get; set; }
            public string TicketText { get; set; }
            public string Status { get; set; }
        }

    The view looks like this:

        @model zfCoreTicketing.Models.zfTicket

        <div>
            <h4>zfTicket</h4>
            <hr />
            <dl class="row">
                <dt class="col-sm-2">
                    <dr>  </dr>
                    <dr> TicketId: <input asp-for="TicketId" /></dr>
                    <dr> Created Date: <input asp-for="TicketCreationDate" /></dr>
                    <dr> Title: <input asp-for="TicketTitle" /></dr>
                    <dr> Assigned To: <input asp-for="AssignedTo" /></dr>
                    <dr> Severity: <input asp-for="Severity" /></dr>
                    <dr> Text: <input asp-for="TicketText" /></dr>
                    <dr> Status <input asp-for="Status" /></dr>
                    @*<input asp-for="Severity" />
                        <input asp-for="TicketTitle" />*@
                </dt>
            </dl>
        </div>
        <div>
            <a asp-action="Edit" asp-route-id="@Model">Edit</a> |
            <a asp-action="Index">Back to List</a>
        </div>
    </form>

    ** When clicking the Edit action, I want to return all the values from the ticket back to the controller to perform an update

    • Moved by CoolDadTx Friday, May 17, 2019 2:28 PM ASP.NET related
    Thursday, May 16, 2019 9:23 PM

All replies

  • Can anyone point me to documentation on how to wrap fields back into a class and return it back to a controller?

    ASP.NET MVC can be discussed at the ASP.NET forums.

    http://forums.asp.net/

    Thursday, May 16, 2019 9:51 PM
  • Hi

    Thank you for posting here.

    Since this thread is related to asp.net core, you could post in the following forum.

    https://forums.asp.net/1255.aspx/1?ASP+NET+Core​​​​​​​

    The Visual C# forum discusses and asks questions about the C# programming language, IDE, libraries, samples, and tools.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, May 17, 2019 1:21 AM