Example #1
0
        public Utilisateur GetUser([FromQuery] int id)
        {
            Utilisateur Retour = null;

            ViewUser MyUser = DB_CURD.GetUser(id);

            if (MyUser != null)
            {
                Retour = new Utilisateur
                {
                    IdUser    = MyUser.IdUser,
                    Pseudo    = MyUser.Pseudo,
                    Email     = MyUser.Email,
                    Organizer = MyUser.Organizer,
                    Deleted   = MyUser.Deleted,
                    PseudoIgs = DB_CURD.GetPseudosUser(id),
                    Resultas  = DB_CURD.GetResultasOfUser(id)
                };
            }


            return(Retour);
        }
Example #2
0
        public RetourAPI UpdateUserIgPseudo(Utilisateur Utilisateur)
        {
            List <ViewPseudo> ListPseudo = DB_CURD.GetPseudosUser(Utilisateur.IdUser);

            int count    = 0;
            int reussite = 0;

            foreach (ViewPseudo pseudo in Utilisateur.PseudoIgs)
            {
                if (!ListPseudo.Contains(pseudo))
                {
                    count++;
                    if (ListPseudo.Any(p => p.IdGame == pseudo.IdGame))
                    {
                        if (string.IsNullOrWhiteSpace(pseudo.IgPseudo) && DB_CURD.DeletePseudoIG(pseudo).Succes)
                        {
                            reussite++;
                        }
                        else if (DB_CURD.EditPseudoIG(pseudo).Succes)
                        {
                            reussite++;
                        }
                    }
                    else if (string.IsNullOrEmpty(pseudo.IgPseudo))
                    {
                        count--;
                    }
                    else if (DB_CURD.AddPseudoIG(pseudo).Succes)
                    {
                        reussite++;
                    }
                }
            }

            return(new RetourAPI(reussite == count,
                                 reussite + " Pseudo sur " + count + " on ete mis a jours"));
        }