public User ClearRolesByUser(User user) { using (var context = new AirTrackContext()) { context.SaveChanges(); return(user); } }
public Role GetRoleByName(string name) { using (var context = new AirTrackContext()) { return(context.Roles.Where(x => x.Name.Equals(name)).FirstOrDefault()); } }
public Role GetById(int Id) { using (var context = new AirTrackContext()) { return(context.Roles.Find(Id)); } }
public List <Role> GetAll() { using (var context = new AirTrackContext()) { return(context.Roles.ToList()); } }
public List <User> GetUsersRole(string roleName) { using (var context = new AirTrackContext()) { var users = context.Users.Include(u => u.Roles).ToList(); return(users); } }
public User GetById(int Id) { using (var context = new AirTrackContext()) { // var user = context.Users.Include(x => x.Roles).Where(x=>x.Id == Id).FirstOrDefault(); return(context.Users.Find()); } }
public List <User> GetAll() { using (var context = new AirTrackContext()) { var users = context.Users.Include(x => x.Roles).ToList <User>(); context.SaveChanges(); return(users); } }
public void Delete(int Id) { using (var context = new AirTrackContext()) { var user = GetById(Id); context.Users.Remove(user); context.SaveChanges(); } }
public User Create(User user) { using (var context = new AirTrackContext()) { context.Users.Add(user); context.SaveChanges(); return(user); } }
public Role Update(Role role) { using (var context = new AirTrackContext()) { context.Roles.Update(role); context.SaveChanges(); return(role); } }
public void Delete(int Id) { using (var context = new AirTrackContext()) { var role = GetById(Id); context.Roles.Remove(role); context.SaveChanges(); } }