Exemple #1
0
        public Casting NewFromForm(CastingViewModel viewModel)
        {
            this.Wording            = viewModel.Libelle;
            this.AgeMin             = viewModel.AgeMin;
            this.AgeMax             = viewModel.AgeMax;
            this.DescriptionPost    = viewModel.DescriptionPoste;
            this.DescriptionProfile = viewModel.DescriptionProfil;

            return(this);
        }
        public IActionResult Add(CastingViewModel castingViewModel)
        {
            if (ModelState.IsValid)
            {
                Casting casting = new Casting();
                casting.NewFromForm(castingViewModel);

                casting.CreatorId = getIdCurrentUser();
                _castingRepository.Add(casting);

                return(RedirectToAction("Index", "Account"));
            }

            return(View(castingViewModel));
        }