Beispiel #1
0
        public Task <bool> DeletePostAsync(string key, string postid, string username, string password, bool publish)
        {
            EnsureUser(username, password);

            return(TryExecuteAsync(async() =>
            {
                if (!Guid.TryParse(postid.Trim(), out var id))
                {
                    throw new ArgumentException("Invalid ID", nameof(postid));
                }

                await _postManageService.DeleteAsync(id, publish);
                return true;
            }));
        }
Beispiel #2
0
        public async Task <IActionResult> Delete([NotEmpty] Guid postId)
        {
            await _postManageService.DeleteAsync(postId, true);

            return(NoContent());
        }