public void AcceptFriendRequest(DoctrinaUser user, DoctrinaUser friend) { Friendship userToFriend = _db.Find <Friendship>(user.Id, friend.Id); Friendship friendToUser = _db.Find <Friendship>(friend.Id, user.Id); userToFriend.IsInvitationPending = false; friendToUser.IsRequestPending = false; _db.Update <Friendship>(userToFriend); _db.Update <Friendship>(friendToUser); _db.SaveChanges(); }
public void DeleteGroup(string id) { DoctrinaGroup group = _db.Find <DoctrinaGroup>(id); IList <DoctrinaGroupSection> sections = _db.DoctrinaGroupSections.Where(s => s.DoctrinaGroup.Id == group.Id).ToList(); IList <DoctrinaUserDoctrinaGroup> userGroupRelations = _db.DoctrinaUserDoctrinaGroup.Where(gu => gu.DoctrinaGroupId == group.Id).ToList(); foreach (var section in sections) { DeleteSection(section.Id); } foreach (var relation in userGroupRelations) { _db.Remove <DoctrinaUserDoctrinaGroup>(relation); } string folderPath = Path.Combine(_hostingEnvironment.WebRootPath, "DynamicResources/groups", group.Id); Directory.Delete(folderPath); _db.Remove <DoctrinaGroup>(group); _db.SaveChanges(); }