/// <summary> /// Usunięcie użytkownika. /// </summary> /// <param name="provider">Usuwany użytkownik.</param> public void Delete(ServiceProvider provider) { string name = ((SimpleMembershipProvider)Membership.Provider).GetUserNameFromId(provider.UserId); _db.ServiceProviders.Remove(provider); _db.SaveChanges(); Roles.RemoveUserFromRole(name, "ServiceProvider"); ((SimpleMembershipProvider)Membership.Provider).DeleteAccount(name); ((SimpleMembershipProvider)Membership.Provider).DeleteUser(name, true); }
/// <summary> /// Usunięcie użytkownika. /// </summary> /// <param name="customer">Usuwany użytkownik.</param> public void Delete(Customer customer) { string name = ((SimpleMembershipProvider)Membership.Provider).GetUserNameFromId(customer.UserId); database.Customers.Remove(customer); database.SaveChanges(); Roles.RemoveUserFromRole(name, "Customer"); ((SimpleMembershipProvider)Membership.Provider).DeleteAccount(name); ((SimpleMembershipProvider)Membership.Provider).DeleteUser(name, true); }
/// <summary> /// Zapisanie zmian. /// </summary> public void SaveChanges() { _db.SaveChanges(); }