Esempio n. 1
0
        public async Task <IActionResult> Create(UpdateFunctionViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var entity = _mapper.Map <Function>(viewModel);

                if (entity.ParentId == 0)
                {
                    entity.ParentId = null;
                }

                await _functionService.CreateAsync(entity);

                return(RedirectToAction(nameof(Index)));
            }

            await AssignHierarchicalFunctionsAsync(viewModel);

            return(View("Update", viewModel));
        }
Esempio n. 2
0
        public async override Task <IActionResult> CreateFunctionAsync([FromBody] FunctionSubmit functionSubmit)
        {
            var loggedOnUser = ClaimsHelper.GetScalarClaimValue <Guid>(User, ClaimTypes.NameIdentifier, Guid.Empty);

            return(Ok(await functionService.CreateAsync(functionSubmit, loggedOnUser)));
        }
Esempio n. 3
0
 public async Task <AjaxResult> CreateAsync([FromBody] FunctionInputDto dto)
 {
     return((await _functionService.CreateAsync(dto)).ToAjaxResult());
 }