Example #1
0
        public async Task <IActionResult> RemoveStory(int id)
        {
            var story = await _repos.GetStory(id);

            if (story == null)
            {
                return(NotFound());
            }
            _repos.Remove(story);
            if (await _repos.SaveAll())
            {
                return(NoContent());
            }
            return(BadRequest("Failed to delete story"));
        }
Example #2
0
        public async Task <IActionResult> DeleteVideo(int id)
        {
            var video = await _repos.GetVideo(id);

            if (video == null)
            {
                return(BadRequest("Video does not exist"));
            }
            _repos.Remove(video);
            if (await _repos.SaveAll())
            {
                return(NoContent());
            }

            return(BadRequest(" failed to delete video"));
        }