I have created a new project in studio and then connected it to my sql server using the option generate pages for CRUD operations.
the pages.cs is
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Test10311.Models.Club_001
{
[Table("Rooms", Schema = "dbo")]
public partial class Room
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int RoomID { get; set; }
public string RoomName { get; set; }
public bool? RoomInUse { get; set; }
public decimal? RoomHourlyRate { get; set; }
public bool? RoomAvailable { get; set; }
public bool? RoomSingle { get; set; }
public int? RoomAutoCheckOut { get; set; }
}
public partial class RoomListClass
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int RoomID { get; set; }
public string RoomName { get; set; }
}
}
I added the RoomListClass
I want to use the code below
I get that my code should look like below but I don;'t understand how to get the data.
@code {
string ValueRoom;
IEnumerable RoomList;
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
RoomList = ???????????????????????????; // This is the part I'm missing
}
}
so what to I do to get Roomlist to a list of RoomListClass using the CRUD that was built for the table Rooms?
Thanks Kirk