예제 #1
0
        public async Task <ActionResult> Edit([FromRoute] int id, [FromForm] VideoCardDtoViewModel videoCard)
        {
            var dto = _mapper.Map <VideoCardDtoViewModel, VideoCardUpdateDto>(videoCard);

            var result =
                await _videoCardsManagingService.UpdateVideoCardAsync(id, dto, HttpContext.GetJwtTokenFromCookie());

            return(!result?RedirectToAction("ServerErrorIndex", "Error") : RedirectToAction("VideoCardsTable"));
        }
예제 #2
0
        public async Task <ActionResult> Create([FromForm] VideoCardDtoViewModel videoCard)
        {
            var dto = _mapper.Map <VideoCardDtoViewModel, VideoCardInsertDto>(videoCard);

            var insertResult =
                await _videoCardsManagingService.CreateVideoCardAsync(dto, HttpContext.GetJwtTokenFromCookie());

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

            return(Problem());
        }