public async Task <IActionResult> RemoveVideo(string id) { if (!await _repository.CheckIfExists(id)) { return(NotFound(id)); } await _repository.DeleteVideo(id); return(NoContent()); }
public ActionResult DeleteVideo(long?id) { if (UsersHelper.LoggedInUserUsername(Session) == null) { return(null); } if (_videosRepository.GetVideoById(id) == null) { return(null); } _videosRepository.DeleteVideo(id); ViewBag.Message = "Video has been successfully deleted."; return(PartialView("MessageModal")); }
public async Task <ActionResult> Delete(int videoId) { if (videoId == 0) { _logger.LogError("In cvideos controller, delete a video missing the id"); return(BadRequest("Video id must be provided.")); } var num = await _videoRepo.DeleteVideo(videoId); if (num < 1) { _logger.LogError("In cvideo controller, delete video returned 0 from repo"); return(BadRequest("The video item was not deleted.")); } var confirm = _confirm.ConfirmResponse(true, "A Video item was deleted successfully."); return(Ok(confirm)); }