Beispiel #1
0
        public async Task <ActionResult> Edit([FromRoute] int id, [FromForm] CaseDtoViewModel @case)
        {
            var dto = _mapper.Map <CaseDtoViewModel, CaseUpdateDto>(@case);

            var result =
                await _casesManagingService.UpdateCaseAsync(id, dto, HttpContext.GetJwtTokenFromCookie());

            return(!result?RedirectToAction("ServerErrorIndex", "Error") : RedirectToAction("CasesTable"));
        }
Beispiel #2
0
        public async Task <ActionResult> Create([FromForm] CaseDtoViewModel @case)
        {
            var dto = _mapper.Map <CaseDtoViewModel, CaseInsertDto>(@case);

            var insertResult =
                await _casesManagingService.CreateCaseAsync(dto, HttpContext.GetJwtTokenFromCookie());

            if (insertResult)
            {
                return(RedirectToAction("CasesTable"));
            }

            return(Problem());
        }