I have boolean functions like this:
<h3 class="text-info">@(objRoom.Id != 0 ? "Update" : "Create") Room</h3>
How do I change it to make it work when the primary key is a Guid instead of an Int?
I have boolean functions like this:
<h3 class="text-info">@(objRoom.Id != 0 ? "Update" : "Create") Room</h3>
How do I change it to make it work when the primary key is a Guid instead of an Int?
You need to Follow as:
Change DataType of DB Column With UniqueId from Int/BigInt
Create/Change Property Data Type in Model class
Public Guid Id { get; set;} or if it is nullable then Public Guid? Id { get; set;}
Then check if it is null or not while using Id == Guid.Empty
// Pseudo code
if(Id == Guid.Empty ? "Create" : "Update"){
}
Mark it Solve if answers your question