public string AddTheme([FromBody] ThemeDto themeDto)
        {
            var theme = mapper.Map <Theme>(themeDto);

            themeRepository.Insert(theme);
            return(theme.Id.ToString());
        }
Exemple #2
0
        public JsonResult AddTheme(Theme theme, int organisationID, int subOrganisationID, int applicationID)
        {
            ThemeRepository themeRepository = new ThemeRepository();
            int             id = themeRepository.Insert(theme);

            Mapping mapping = new Mapping()
            {
                OrganisationID    = organisationID == 0 ? null : (int?)Convert.ToInt32(organisationID),
                SubOrganisationID = subOrganisationID == 0 ? null : (int?)Convert.ToInt32(subOrganisationID),
                ApplicationID     = applicationID == 0 ? null : (int?)Convert.ToInt32(applicationID),
                ThemeID           = id
            };
            MappingRepository mappingRepository = new MappingRepository();

            mappingRepository.Insert(mapping);

            return(Json(new { id = id }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                Theme theme = Theme.Create(collection["Title"], collection["Description"]);

                _themeRepository.Insert(theme);

                Request.Flash("success", "Thema is opgeslagen");

                return(RedirectToAction("Index"));
            }
            catch (Exception)
            {
                Request.Flash("error", "Er is iets mis gegaan bij het opslaan");

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