public Denounced create(Denounced denounced) { foodForAllContext.Denounced.Add(denounced); foodForAllContext.SaveChanges(); int complaints = findByIdUser(denounced.IdUser); if (complaints == 5) { User user = userService.findById(denounced.IdUser); ListBlack listBlack = new ListBlack(); listBlack.IdUser = user.Id; listBlack.OneSignalPlayerId = user.OneSignalPlayerId; listBlack.Phone = user.Phone; listBlack.Email = user.Email; listBlackService.create(listBlack); userService.deleteById(user.Id); } return(denounced); }
public ListBlack create(ListBlack listBlack) { foodForAllContext.ListBlack.Add(listBlack); foodForAllContext.SaveChanges(); return(listBlack); }
public ListBlack findByUser(User user) { ListBlack listBlack = (from lb in foodForAllContext.ListBlack where lb.OneSignalPlayerId == user.OneSignalPlayerId || lb.Phone == user.Phone || lb.Email == user.Email select lb).FirstOrDefault(); return(listBlack); }