Example #1
0
        public async Task <IActionResult> Add(RoleViewModel model)
        {
            ViewData["Title"] = "Add Application Role";
            if (ModelState.IsValid)
            {
                var res = await _repo.Insert(model);

                if (res.status)
                {
                    Roles = null;
                }
                return(Json(res));
            }
            return(PartialView("_Add", model));
        }
Example #2
0
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            //TODO: Need some more input validation here. EX Role name should be UQ
            var role = new Role {
                Name        = Input.Name,
                Description = Input.Description
            };

            _roleRepo.Insert(role);

            return(RedirectToPage());
        }
        public async Task <ActionResult> CreateQuestionnaire([FromBody] InsertRoleRequest model)
        {
            await _roleRepo.Insert(model.Pavadinimas);

            return(new AcceptedResult());
        }