Ejemplo n.º 1
0
        public async Task <ActionResult> Create([FromBody] ThemeModel themeModel)
        {
            var themeEntity = themeModel.ToEntity();

            await themeService.Create(themeEntity);

            return(Ok());
        }
Ejemplo n.º 2
0
 public ActionResult CreateNewTheme(ThemeCreateViewModels model)
 {
     if (ModelState.IsValid)
     {
         _themeService.Create(model);
         return(RedirectToAction("AboutThemes"));
     }
     else
     {
         return(View(model));
     }
 }
        public IActionResult Post([FromBody] ThemeVM model)
        {
            ThemeVM theme = _themeService.GetAll().Where(x => x.Name == model.Name).FirstOrDefault();

            if (theme != null)
            {
                ModelState.AddModelError(string.Empty, "Theme is already exists");

                return(BadRequest(ModelState));
            }

            _themeService.Create(model);

            return(Ok(model));
        }
Ejemplo n.º 4
0
        public ActionResult CreateTheme(ThemeViewModel model)
        {
            if (themeService.GetOneByPredicate(t => t.Name == model.Name) != null)
            {
                ModelState.AddModelError("", "Category with this name already registered.");
                return(View(model));
            }
            if (model == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var newTheme = model.ToBllTheme();

            themeService.Create(newTheme);

            return(RedirectToAction("CreateTest"));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Create(CreateThemeRequest request)
        {
            var dic = new Dictionary <string, string>
            {
                { "--accent-color1", request.AccentColor1 },
                { "--accent-color2", request.AccentColor2 },
                { "--accent-color3", request.AccentColor3 }
            };

            var id = await _themeService.Create(request.Name, dic);

            if (id == 0)
            {
                return(Conflict("Theme with same name already exists"));
            }

            return(Ok(id));
        }
Ejemplo n.º 6
0
        public IActionResult Create(ThemeRequest themeRequest)
        {
            var theme = new ThemeEditDTO
            {
                Name      = themeRequest.Name,
                SectionId = themeRequest.SectionId,
                Open      = themeRequest.Open,
                Text      = themeRequest.Text
            };

            var res = ThemeService.Create(theme, GetUser());

            if (res.Code == AccessCode.Succsess)
            {
                return(RedirectToAction("Index", new { id = res.Id }));
            }
            else
            {
                return(Redirect(res.Code));
            }
        }