public void InsertOrUpdate(User user) { if (user.Id == default(int)) { // New entity context.Users.Add(user); } else { // Existing entity context.Entry(user).State = EntityState.Modified; } }
public CustomUser(string providername, User userAccount) : base(providername, userAccount.UserName, userAccount.Id, userAccount.Email, "", string.Empty, true, false, userAccount.CreationDate, userAccount.LastLoginDate ?? userAccount.CreationDate, userAccount.LastActivityDate ?? userAccount.CreationDate, new DateTime(), new DateTime()) { this.UserAccount = userAccount; }