public async Task <IActionResult> DeleteVideo(int id) { var model = await GenericGetDataClass <VideoModel> .GetAllData($"api/video/{id}"); var response = await GenericGetDataClass <VideoModel> .DeleteData($"api/deletevideo/{id}"); if (response) { var webRootPath = _hostingEnvironment.WebRootPath; // Получаем путь из модели и удаляем первый символ (/) var replacedPath = model.Path.Substring(1); var path = Path.Combine(webRootPath, replacedPath); if (System.IO.File.Exists(path)) { System.IO.File.Delete(path); } TempData["SM"] = "Видео успешно удалено!"; return(RedirectToAction(nameof(ShowAllVideo))); } else { //TODO: вывод ошибок return(RedirectToAction(nameof(ShowAllVideo))); } }
public async Task <IActionResult> AddVideo() { var categories = await GenericGetDataClass <List <CategoryModel> > .GetAllData("api/categories"); ViewData["CategoryList"] = categories.ToList(); return(View()); }
public async Task <IActionResult> EditCategory(int id) { var category = await GenericGetDataClass <CategoryModel> .GetAllData($"api/category/{id}"); return(View(category)); }
public async Task <IActionResult> EditUser(int id) { var user = await GenericGetDataClass <EmployeeModel> .GetAllData($"api/user/{id}"); return(View(user)); }
public async Task <IActionResult> ShowAllCategories() { var categories = await GenericGetDataClass <List <CategoryModel> > .GetAllData("api/categories"); return(View(categories)); }
public async Task <IActionResult> ShowAllUsers() { var users = await GenericGetDataClass <IEnumerable <EmployeeModel> > .GetAllData("api/users"); return(View(users)); }
public async Task <IActionResult> EditVideo(int id) { var video = await GenericGetDataClass <VideoModel> .GetAllData($"api/video/{id}"); return(View(video)); }
public async Task <IActionResult> ShowAllVideo() { var videos = await GenericGetDataClass <List <VideoModel> > .GetAllData("api/videos"); return(View(videos)); }