/// <summary> /// Getall list of Videso /// </summary> /// <returns></returns> public List <VideoVM> GetAllVideos() { var videoVMList = new List <VideoVM>(); var videoList = _videoRepository.GetAllVideos(); if (videoList.Count != 0) { foreach (var video in videoList) { videoVMList.Add(new VideoVM { VideoDescription = video.VideoDescription, VideoName = video.VideoName, VideoPath = video.VideoPath, VideoSize = video.VideoSize, VideoId = video.Id, CategoryId = video.CategoryId, CategoryName = _categoryBAL.GetCategoryById(video.CategoryId).CategoryName }); } } return(videoVMList); }
public IActionResult Delete(int id) { try { var category = _categoryBAL.GetCategoryById(id); if (category.CategoryName != null) { _categoryBAL.DeleteCatergory(id); return(Ok()); } return(NotFound("Category with id=" + id.ToString() + "not found to delete.")); } catch (Exception ex) { // log the exception using ILogger return(BadRequest()); } }