Exemplo n.º 1
0
        public ActionResult Create(CreateThesisThemeViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (this.User.IsInRole(GlobalConstants.TEACHER))
                {
                    var theme = Mapper.Map<ThesisTheme>(model);
                    theme.TeacherId = this.User.Identity.GetUserId();

                    this.Data.ThesisThemes.Add(theme);

                    this.Data.SaveChanges();
                }

                return RedirectToAction("Themes");
            }

            return View(model);
        }
Exemplo n.º 2
0
        public ActionResult Create(CreateThesisThemeViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (this.User.IsInRole(GlobalConstants.TEACHER))
                {
                    var theme = Mapper.Map <ThesisTheme>(model);
                    theme.TeacherId = this.User.Identity.GetUserId();

                    this.Data.ThesisThemes.Add(theme);

                    this.Data.SaveChanges();
                }

                return(RedirectToAction("Themes"));
            }

            return(View(model));
        }