public async Task <IActionResult> Create(VideoCreateInputModel input) { var user = await this.userManager.GetUserAsync(this.User); if (user.ChannelId == null) { return(this.Redirect("/Channels/Create")); } if (!this.ModelState.IsValid) { return(this.View(input)); } if (!this.videosService.IsValidTitle(input.Title)) { input.Categories = this.categoriesService.GetAllCategories <CategoryDropDownViewModel>(); input.ExistingTitle = "This title already exist!"; return(this.View(input)); } if (!this.videosService.IsValidUrl(input.Url)) { input.Categories = this.categoriesService.GetAllCategories <CategoryDropDownViewModel>(); input.ExsistingUrl = "This url already exist!"; return(this.View(input)); } var videoId = await this.videosService.CreateVideoAsync(input.Title, input.Url, input.Description, input.CategoryId, user.Id, user.ChannelId); return(this.RedirectToAction("Details", new { Id = videoId })); }
public IActionResult Create() { var viewModel = new VideoCreateInputModel { Categories = this.categoriesService.GetAllCategories <CategoryDropDownViewModel>(), }; return(this.View(viewModel)); }
public async Task <IActionResult> CreateVideo(VideoCreateInputModel input) { if (!this.ModelState.IsValid) { return(this.View(input)); } var videoId = await this.videosService.CreateAsync(input.Title, input.Description, input.VideoUrl, input.Category); return(this.RedirectToAction("Video", "Video", new { id = videoId, area = string.Empty })); }
public IActionResult CreateVideo() { var viewModel = new VideoCreateInputModel(); return(this.View(viewModel)); }