Important note: the column online in my MySQL table is of type enum and I'm not allowed to change the database
So here's my entity:
public enum onlineStatus { online = 1, offline = 0 };
public onlineStatus online { get; set; }
And in my db context:
public class UsersContext : DbContext
{
public DbSet<User> Users { get; set; }
public void AddUser(User user) // I'm using a custom membership provider that calls this method
{
try
{
user.online = 0; // this will give me the word "offline"
Users.Add(user);
SaveChanges();
}
catch (Exception ex)
{
throw ex;
}
}
}
Somehow user.online = 0; doesn't add to the database. And how do I make it so that it saves the value 0 instead of offline. Thanks in advance.