public int Delete(UserLoginTable userLogin) { if (_database.Entry(userLogin).State == System.Data.Entity.EntityState.Detached) { dbSet.Attach(userLogin); } dbSet.Remove(userLogin); return this.Save(); }
/// <summary> /// Inserts a new login in the UserLogins table /// </summary> /// <param name="user">User to have new login added</param> /// <param name="login">Login to be added</param> /// <returns></returns> /*public int Insert(IdentityUser user, UserLoginInfo login) { string commandText = "Insert into UserLogins (LoginProvider, ProviderKey, UserId) values (@loginProvider, @providerKey, @userId)"; Dictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("loginProvider", login.LoginProvider); parameters.Add("providerKey", login.ProviderKey); parameters.Add("userId", user.Id); return _database.Execute(commandText, parameters); }*/ public int Insert(IdentityUser user, UserLoginInfo login) { var userLogin = new UserLoginTable { LoginProvider = login.LoginProvider, ProviderKey = login.ProviderKey, UserId = user.Id }; dbSet.Add(userLogin); return this.Save(); }