Пример #1
0
        public async Task <IActionResult> Edit([FromBody] CommentDetail model)
        {
            var result = await _commentsService.EditAsync(model);

            if (result.IsSuccess)
            {
                return(Ok(result));
            }

            return(BadRequest(result));
        }
Пример #2
0
        public async Task <IActionResult> Edit(CommentModifyInputModel modifiedModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(modifiedModel));
            }

            try
            {
                await _commentsService.EditAsync(modifiedModel);
            }
            catch (Exception e)
            {
                _logger.LogError(e, $"An exception occured during comment UPDATE operation for commentId: {modifiedModel.Id}.");
                return(RedirectToAction("Error", "Home"));
            }

            return(RedirectToAction(nameof(All)));
        }