public async Task <ResponseFromApi <int> > UpdatePost(PostDetailBlazorVM postDetailViewModel) { try { UpdatePostCommand updatePostCommand = _mapper.Map <UpdatePostCommand>(postDetailViewModel); await _client.UpdatePostAsync(updatePostCommand); return(new ResponseFromApi <int>() { Success = true }); } catch (ApiException ex) { return(ex.ConvertApiExceptions()); } }
public async Task <ResponseFromApi <int> > CreatePost(PostDetailBlazorVM postDetailViewModel) { try { CreatedPostCommand createPostCommand = _mapper.Map <CreatedPostCommand>(postDetailViewModel); var newId = await _client.AddPostAsync(createPostCommand); return(new ResponseFromApi <int>() { Data = newId, Success = true }); } catch (ApiException ex) { return(ex.ConvertApiExceptions()); } }