public ActionResult Create(FormCollection collection)
        {
            try
            {
                string value = collection["Pattern"];

                FormationService service   = new FormationService();
                Formation        formation = service.GetFormationByPattern(value);



                //var uniquePathCreator = new UniquePathCreator();
                //var permutations = uniquePathCreator.CreateUniquePath(formation);

                var analyzer = new SquadCreator();
                analyzer.BuildPerfectSquad(formation, formation.Permutations);


                return(RedirectToAction("SquadResult"));
            }
            catch (Exception e)
            {
                return(View());
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            FormationService ps = new FormationService();
            Producteur       p  = new Producteur {
                Nom = "test", prenom = "test", DateNaissance = DateTime.Now
            };

            ps.Add(p);
            ps.Commit();
            CandiratService fs = new CandiratService();
            Film            f  = new Film
            {
                Titre       = "film1",
                Description = "Test",
                // DateProd = DateTime.Now,
                DateProd   = new DateTime(2016, 1, 1, 12, 00, 00),
                Price      = 15,
                Genre      = "Action",
                Evaluation = "Super",
                //avec validation
                // Genre = "ok",
                //Evaluation = "suoer",
                ImageUrl     = "image",
                ProducteurId = 1
            };

            fs.Add(f);
            fs.Commit();
        }
 public FormationController()
 {
     MyUser                 = new UserService();
     MyFormationService     = new FormationService();
     MyEnfantService        = new EnfantService();
     MyParticipationService = new ParticipationService();
     MyActiviteService      = new ActiviteService();
 }
Esempio n. 4
0
        // GET: Quiz/Edit/5
        public ActionResult Edit(int id)

        {
            fs = new FormationService();
            var Formations = fs.GetMany().Where(f => f.niveauobt.Equals("master"));

            ViewBag.formation_id_for = new SelectList(Formations, "id_for", "nom_for", fs.GetById((int)qz.GetById(id).formation_id_for).nom_for);
            return(View(qz.GetById(id)));
        }
Esempio n. 5
0
        // GET: Quiz/Create
        public ActionResult Create()
        {
            fs = new FormationService();
            var Formations = fs.GetMany().Where(f => f.niveauobt.Equals("master"));

            ViewBag.formation_id_for = new SelectList(Formations, "id_for", "nom_for");

            return(View());
        }
        public ActionResult Index()
        {
            FormationService service = new FormationService();
            var formations           = service.GetFormations();

            FifaBestSquadWeb.Models.FormationViewModel formationViewModel = new FifaBestSquadWeb.Models.FormationViewModel();

            foreach (var formation in formations)
            {
                formationViewModel.Patterns.Add(new SelectListItem
                {
                    Text  = formation.Pattern,
                    Value = formation.Pattern
                });
            }

            return(View(formationViewModel));
        }
 public FormationApiController()
 {
     FormationService formationService = new FormationService();
     _formationService = formationService;
 }
Esempio n. 8
0
 public FormationController()
 {
     serviceFormation = new FormationService();
 }
Esempio n. 9
0
        public async Task CreateService()
        {
            var options = new DbContextOptionsBuilder <LineupDbContext>()
                          .UseInMemoryDatabase(databaseName: "LineupTestDb")
                          .EnableSensitiveDataLogging()
                          .UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking)
                          .Options;

            var dbContext = new LineupDbContext(options);

            if (await dbContext.Formations.CountAsync() <= 0)
            {
                //FORMATION 1
                FormationDto formation1 = new FormationDto()
                {
                    id     = 1,
                    Name   = "Test-1",
                    TeamId = 1
                };
                dbContext.Formations.Add(formation1);
                for (int i = 1; i < 11; i++)
                {
                    PlayerPositionDto pp = new PlayerPositionDto()
                    {
                        FormationId = formation1.id,
                        PlayerId    = i,
                        id          = i,
                        position    = (Position)i
                    };
                    dbContext.PlayerPositions.Add(pp);
                }

                //FORMATION 2
                FormationDto formation2 = new FormationDto()
                {
                    id     = 2,
                    Name   = "Test-2",
                    TeamId = 1
                };
                dbContext.Formations.Add(formation2);
                for (int i = 1; i < 11; i++)
                {
                    PlayerPositionDto pp = new PlayerPositionDto()
                    {
                        FormationId = formation2.id,
                        PlayerId    = i,
                        id          = i + 11,
                        position    = (Position)i
                    };
                    dbContext.PlayerPositions.Add(pp);
                }

                //FORMATION 3
                FormationDto formation3 = new FormationDto()
                {
                    id     = 3,
                    Name   = "Test-3",
                    TeamId = 1
                };
                dbContext.Formations.Add(formation3);
                for (int i = 1; i < 11; i++)
                {
                    PlayerPositionDto pp = new PlayerPositionDto()
                    {
                        FormationId = formation3.id,
                        PlayerId    = i,
                        id          = i + 22,
                        position    = (Position)i
                    };
                    dbContext.PlayerPositions.Add(pp);
                }

                await dbContext.SaveChangesAsync();
            }
            var formationRepository = new FormationRepository(dbContext);

            _formationService = new FormationService(formationRepository);
        }
Esempio n. 10
0
 public CandidatController()
 {
     serviceCandidat  = new CandiratService();
     serviceFormation = new FormationService();
 }