//confirm user email public static void EmailConfirm(string email) { using (var context = new NeedleWork2016Context()) { var user = context.AspNetUsers.Where(m => m.Email == email).FirstOrDefault(); user.EmailConfirmed = true; context.SaveChanges(); } }
//User deletion by Id public static void DeleteUserData(string _id) { //GetAllUsers(x=>x.Email=="@mail.ru"); using (var context = new NeedleWork2016Context()) { //Linq request for delition user by Id var User = context.AspNetUsers.Where(c => c.Id == _id).FirstOrDefault(); context.AspNetUsers.Remove(User); context.SaveChanges(); } }
//User editing by Id public static void EditUser(AspNetUsers user) { using (var context = new NeedleWork2016Context()) { var User = context.AspNetUsers.Where(c => c.Id == user.Id).FirstOrDefault(); if (User != null) { User.Id = user.Id; User.Email = user.Email; User.FirstName = user.FirstName; User.LastName = user.LastName; context.SaveChanges(); } } }