.NET Core 2.1 MVC application to mark attendance RRS feed

  • Question

  • Hello!

    I'm posting a bunch of details to be as clear as I can be so bear with me.

    I've recently started learning .NET Core & MVC by following some courses on Microsoft Virtual Academy & PluralSight. At the same time I'm using what I'm learning to create an application to Capture Attendance.

    I have googled and found a bunch of awsome examples from github, however I have decied to build my own to make it suit my requirements and to learn this technology more!

    The name of the application is quite descriptive, I need an application where I can create MembersEvents. Then at any time I would like to be able to create an Event containing all of my Membersand mark these as Present or Absent.

    A colleague helped me design the database using EntityFramework, take a look at my models and the tables created based on them:

    public class Members
        public int Id { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string FullName { get; set; }
        public DateTime DateOfBirth { get; set; }
        public string Email { get; set; }
        public string TelephoneNumber { get; set; }
        public List<MemberToEvents> MemberToEvents { get; set; }

    public class Events
        public int Id { get; set; }
        public DateTime EventDate { get; set; }
        public List<MemberToEvents> MemberToEvents { get; set; }
    public class MemberToEvents
        public int Id { get; set; }
        public bool Status { get; set; }
        public Events Event { get; set; }
        public Members Member { get; set; }

    After scaffolding and deploying I get my tables created exactly as planned:

    • dbo.MemberToEvents
    • dbo.Events
    • dbo.Members

    So far so good, I can now create/view/edit/delete Members and Events.

    Now, using some View(?), I'm looking for a way to capture attendance status for all my members for a specific Event (date) and save it to my MemberToEvents table.

    My little knowledge of this technology is not helping to figure out a solution. Could you please help?
    I'm not posting my not working code because I know it's far from being usable.

    Thanks in advance!

    Wednesday, March 20, 2019 2:19 PM

All replies

  • I would create a hidden div form to capture all the information you need for the event, then display it with jQuery.dialog() on a button click or what to allow user input it, and use ajax to post back result to your controller method.

    Use the return value to determine whether you should update the screen to reflect what the user just entered, or to display error message.

    Of course the precise way would be more dependent on what UI frameworks/libraries you're using (say, with Bootstrap the logic would be similar but the coding will more be "CSS class"/attribute on the div, with Angular you'll be using template and line up the code with their "controller")

    Thursday, March 21, 2019 2:01 AM