Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public ListBlack create(ListBlack listBlack)
        {
            foodForAllContext.ListBlack.Add(listBlack);
            foodForAllContext.SaveChanges();

            return(listBlack);
        }
Ejemplo n.º 3
0
        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);
        }