public void DeletePostSetting(User user, PostSetting postSetting) { User currentUser = _context.Users.FirstOrDefault(u => u.Name == user.Name); PostSetting currentPostSetting = currentUser.PostSettings.FirstOrDefault(p => p.PostSettingId == postSetting.PostSettingId); currentUser.PostSettings.Remove(currentPostSetting); }
public void EditPostSetting(User user, PostSetting postSetting) { User currentUser = _context.Users.FirstOrDefault(u => u.Name == user.Name); PostSetting currentPostSetting = currentUser.PostSettings.FirstOrDefault(p => p.PostSettingId == postSetting.PostSettingId); currentPostSetting.UpdateModel(postSetting); }