public BaseServiceResult <ExtendedCommentModel> Get([FromQuery] Guid commentId) { try { var result = CommentService.Get(commentId); return(BaseServiceResult <ExtendedCommentModel> .Success(result)); } catch (Exception e) { Logger?.LogError(e, $"Trying to: Get comment \"{commentId}\"."); return(BaseServiceResult <ExtendedCommentModel> .Error(e)); } }
public BaseServiceResult <IEnumerable <CommentModel> > Get() { try { var result = CommentService.Get(); return(BaseServiceResult <IEnumerable <CommentModel> > .Success(result)); } catch (Exception e) { Logger?.LogError(e, "Trying to: Get all comments"); return(BaseServiceResult <IEnumerable <CommentModel> > .Error(e)); } }
public BaseServiceResult <Guid> Add([FromBody] AddCommentModel addCommentModel) { try { var newId = CommentService.Add(addCommentModel); return(BaseServiceResult <Guid> .Success(newId)); } catch (Exception e) { Logger?.LogError(e, "Trying to: add comment."); return(BaseServiceResult <Guid> .Error(e)); } }
public BaseServiceResult Delete([FromBody] Guid commentId) { try { CommentService.Delete(commentId); return(BaseServiceResult.Success()); } catch (Exception e) { Logger?.LogError(e, $"Trying to: Delete comment \"{commentId}\"."); return(BaseServiceResult.Error(e)); } }
public BaseServiceResult Update([FromBody] UpdateCommentModel updateCommentModel) { try { CommentService.Update(updateCommentModel); return(BaseServiceResult.Success()); } catch (Exception e) { Logger?.LogError(e, $"Trying to: Update comment \"{updateCommentModel?.Id}\"."); return(BaseServiceResult.Error(e)); } }
public BaseServiceResult <string> GetDescription([FromQuery] Guid commentId) { try { var result = CommentService.GetDescription(commentId); return(BaseServiceResult <string> .Success(result)); } catch (Exception e) { Logger?.LogError(e, $"Trying to: Get description of comment \"{commentId}\"."); return(BaseServiceResult <string> .Error(e)); } }