public ActionResult VideoCategoryList() { VideoCategory d = new VideoCategory(); DataTable dt = d.selectall(); return(View(dt)); }
public async Task <IActionResult> Edit(int id, [Bind("VideoCategoryID,Name")] VideoCategory videoCategory) { if (id != videoCategory.VideoCategoryID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(videoCategory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VideoCategoryExists(videoCategory.VideoCategoryID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(videoCategory)); }
/// <summary> /// Инициализирует новый экземпляр класса <see cref="VkApi"/>. /// </summary> public VkApi() { Browser = new Browser(); Users = new UsersCategory(this); Friends = new FriendsCategory(this); Status = new StatusCategory(this); Messages = new MessagesCategory(this); Groups = new GroupsCategory(this); Audio = new AudioCategory(this); Wall = new WallCategory(this); Database = new DatabaseCategory(this); Utils = new UtilsCategory(this); Fave = new FaveCategory(this); Video = new VideoCategory(this); Account = new AccountCategory(this); Photo = new PhotoCategory(this); Docs = new DocsCategory(this); Likes = new LikesCategory(this); Pages = new PagesCategory(this); Gifts = new GiftsCategory(this); Apps = new AppsCategory(this); NewsFeed = new NewsFeedCategory(this); Stats = new StatsCategory(this); Auth = new AuthCategory(this); RequestsPerSecond = 3; }
public ActionResult Create(HttpPostedFileBase thumbnailFile, CategoryIntro categoryIntro) { if (thumbnailFile != null && thumbnailFile.ContentLength > 0) { string extension = Path.GetExtension(thumbnailFile.FileName); string timeUpload = DateTime.Now.ToString("yyyyMMddHHmmss"); string fileName = Convert.ToInt32((DateTime.Now - new DateTime(2010, 01, 01)).TotalSeconds) + "_" + thumbnailFile.FileName; string currentDomain = System.Configuration.ConfigurationManager.AppSettings["CurrentDomain"]; string folder = "UploadedImages/VideoThumbnail"; string physicalStoragePath = System.Configuration.ConfigurationManager.AppSettings[currentDomain]; string filePath = physicalStoragePath + @"\" + folder + @"\" + fileName; using (new Impersonator("uploaduser", "", "Upload@@123")) { thumbnailFile.SaveAs(filePath); } categoryIntro.Thumbnail = currentDomain + "/" + folder + "/" + fileName; } ModelState.Clear(); TryValidateModel(categoryIntro); if (ModelState.IsValid) { _categoryIntroRepository.InsertOrUpdate(categoryIntro); _categoryIntroRepository.Save(); VideoCategory category = _categoryRepository.Find(categoryIntro.VideoCategoryId); return(Json(new { success = true, groupid = category.GroupId, catid = category.Id })); } //ViewBag.VideoCategoryId = new SelectList(_categoryRepository.All.ToList(), "Id", "Name"); ViewBag.VideoCatGroups = _videoCatGroupRepository.AllIncluding(v => v.VideoCats).OrderBy(v => v.Order).ToList(); var viewStr = this.RenderRazorViewToString("Create", categoryIntro); return(Json(new { success = false, view = viewStr })); }
public JArray Categorylist() { List <VideoCategory> listvideocategory = VideoCategory.GetAll(); listvideocategory = listvideocategory.OrderBy(x => x.OrderNo).ToList(); return(JArray.FromObject(listvideocategory)); }
/// <summary> /// Инициализирует новый экземпляр класса <see cref="VkApi"/>. /// </summary> public VkApi() { Browser = new Browser(); Users = new UsersCategory(this); Friends = new FriendsCategory(this); Status = new StatusCategory(this); Messages = new MessagesCategory(this); Groups = new GroupsCategory(this); Audio = new AudioCategory(this); Wall = new WallCategory(this); Database = new DatabaseCategory(this); Utils = new UtilsCategory(this); Fave = new FaveCategory(this); Video = new VideoCategory(this); Account = new AccountCategory(this); Photo = new PhotoCategory(this); Docs = new DocsCategory(this); Likes = new LikesCategory(this); Pages = new PagesCategory(this); Gifts = new GiftsCategory(this); Apps = new AppsCategory(this); NewsFeed = new NewsFeedCategory(this); Stats = new StatsCategory(this); Auth = new AuthCategory(this); Markets = new MarketsCategory(this); RequestsPerSecond = 3; }
public static string GetDescription(VideoCategory category) { switch (category) { case VideoCategory.TV: return(_seriesDescription); case VideoCategory.News: return(_newsDescription); case VideoCategory.Music: return(_musicDescription); case VideoCategory.Movies: return(_moviesDescription); case VideoCategory.Personal: return(_personalDescription); case VideoCategory.Shorts: return(_shortsDescription); default: return(_otherDescription); } }
public async Task <ActionResult <VideoCategory> > PostVideoCategory(VideoCategory videoCategory) { _context.VideoCategory.Add(videoCategory); await _context.SaveChangesAsync(); return(CreatedAtAction("GetVideoCategory", new { id = videoCategory.Id }, videoCategory)); }
public IEnumerable <Video> List(VideoCategory category) { var items = _repo.GetOverviewQuery(p => p.Category == category).AsEnumerable(); Debug.WriteLine(items.ToJSON()); return(_mapper.Map <IEnumerable <Video> >(items)); }
public ActionResult Delete(int id) { VideoCategory VideoCategory = _VideoCategoryService.GetByID(id); _VideoCategoryService.Remove(VideoCategory); return(Redirect("/SysAdmin/VideoCategory/List")); }
/// <summary> /// Инициализирует новый экземпляр класса <see cref="VkApi"/>. /// </summary> public VkApi(ICaptchaSolver captchaSolver = null) { Browser = new Browser(); Users = new UsersCategory(this); Friends = new FriendsCategory(this); Status = new StatusCategory(this); Messages = new MessagesCategory(this); Groups = new GroupsCategory(this); Audio = new AudioCategory(this); Wall = new WallCategory(this); Board = new BoardCategory(this); Database = new DatabaseCategory(this); Utils = new UtilsCategory(this); Fave = new FaveCategory(this); Video = new VideoCategory(this); Account = new AccountCategory(this); Photo = new PhotoCategory(this); Docs = new DocsCategory(this); Likes = new LikesCategory(this); Pages = new PagesCategory(this); Gifts = new GiftsCategory(this); Apps = new AppsCategory(this); NewsFeed = new NewsFeedCategory(this); Stats = new StatsCategory(this); Auth = new AuthCategory(this); Markets = new MarketsCategory(this); Execute = new ExecuteCategory(this); RequestsPerSecond = 3; MaxCaptchaRecognitionCount = 5; _captchaSolver = captchaSolver; }
public void TestClickingAVideoCategory() { this._model.HistoryStack = new Stack <ObservableCollection <VideoComponent> >(); VideoComponent category = new VideoCategory("User Testimonials", "/storage/sdcard0/SalesApp/Videos/User Testimonials/"); ObservableCollection <VideoComponent> categories = new ObservableCollection <VideoComponent>() { category }; this._model.VideoComponents = categories; VideoComponent video1 = new SalesApp.Core.BL.Models.Modules.Videos.Video("Video 1", "/storage/sdcard0/SalesApp/Videos/User Testimonials/Video 1.MP4"); VideoComponent video2 = new SalesApp.Core.BL.Models.Modules.Videos.Video("Video 2", "/storage/sdcard0/SalesApp/Videos/User Testimonials/Video 2.MP4"); category.Add(video1); category.Add(video2); // Play a video this._model.VideoComponentClicked(category); ObservableCollection <VideoComponent> videos = new ObservableCollection <VideoComponent>() { video1, video2 }; // Test expected model states Assert.That(this._model.Title, Is.EqualTo("User Testimonials")); Assert.That(this._model.VideoComponents, Is.EqualTo(videos)); Assert.That(this._model.HistoryStack.Peek(), Is.EqualTo(categories)); }
public async Task <IActionResult> PutVideoCategory(int id, VideoCategory videoCategory) { if (id != videoCategory.Id) { return(BadRequest()); } _context.Entry(videoCategory).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VideoCategoryExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
protected void btnSave_Click(object sender, EventArgs e) { if (Page.IsValid) { if (Page.IsValid) { if (CurrentCateVideo == null) { VideoCategory vc = new VideoCategory(); vc.CategoryName = txtCategoryName.Text; vc.CreatedBy = UserInfo.UserAccount.AccountName; vc.CreatedTime = DateTime.Now; vc.Order = Convert.ToInt32(rntOrder.Value); vc.ShowInHomepage = ckbShowHomePage.Checked; db.VideoCategories.InsertOnSubmit(vc); db.SubmitChanges(); } else { CurrentCateVideo.CategoryName = txtCategoryName.Text; CurrentCateVideo.Order = Convert.ToInt32(rntOrder.Value); CurrentCateVideo.ShowInHomepage = ckbShowHomePage.Checked; db.SubmitChanges(); } Response.Redirect(Common.GenerateAdminUrl("videocate")); } } }
public int UpdateCategory(CategoryViewModel category) { VideoCategory old_cat = DAManager.VideoCategoriesRepository.Get(cat => cat.CategoryId == category.CategoryId).FirstOrDefault(); if (old_cat != null) { old_cat.Name = category.Name; old_cat.MetaTitle = category.MetaTitle; old_cat.MetaDescription = category.MetaDescription; old_cat.IsPublished = category.IsPublished; old_cat.URL = category.URL; } else { return(-1); } try { DAManager.Save(); return(old_cat.CategoryId); } catch (Exception ex) { logService.WriteError(ex.Message, ex.Message, ex.StackTrace, ex.Source); return(-1); } }
protected void btnNewCategory_Click(object sender, EventArgs e) { // Parse the new category string CatName = Sanitizers.SanitizeGeneralInputString(txtNewCategoryName.Text); string Parent = Sanitizers.SanitizeGeneralInputString(drpParent.SelectedValue); bool Hidden = chkHidden.Checked; bool Private = chkPrivate.Checked; if ((!string.IsNullOrEmpty(CatName)) && (CatName.Length > 2)) { VideoCategory NewCategory = new VideoCategory() { Name = CatName, ParentCategoryID = Parent, IsHidden = Hidden, IsPrivate = Private }; VideoCategoryRepository videoCategoryRepository = new VideoCategoryRepository(); videoCategoryRepository.Insert(NewCategory); txtNewCategoryName.Text = ""; chkHidden.Checked = false; chkPrivate.Checked = false; refreshCategoryList(); } }
public bool AddCategoryImage(int category_id, HttpPostedFileBase _Image, string category_title = "", string caption = "", string description = "") { VideoCategory category = DAManager.VideoCategoriesRepository.Get(cat => cat.CategoryId == category_id).FirstOrDefault(); if (category == null) { return(false); } if (category.Image != null) { DeleteCategoryimage(category.ImageId.Value); } if (_Image != null) { Image img = new Image() { AddDate = DateTime.Now, Caption = caption, Description = description, URL = "" }; DAManager.ImagesRepository.Insert(img); category.Image = img; try { //Save Image in the data base to get its id. DAManager.Save(); //set the image file name string file_name = ""; if (category_title == "") { file_name = (img.ImageId.ToString() + "-" + _Image.FileName).Replace(" ", "-"); } else { file_name = (img.ImageId.ToString() + "-" + category_title + Path.GetExtension(_Image.FileName)).Replace(" ", "-"); } System.Drawing.Image web_image = System.Drawing.Image.FromStream(_Image.InputStream); //save Original Image ImageService.SaveImage((System.Drawing.Image)web_image.Clone(), file_name); //Save Thumnails ImageService.SaveImage((System.Drawing.Image)web_image.Clone(), file_name, CategoryThumbWidth, CategoryThumbHeight); //Update the DB value img.URL = ImageService.GetImagesDirectory() + file_name; DAManager.Save(); } catch (Exception ex) { logService.WriteError(ex.Message, ex.Message, ex.StackTrace, ex.Source); return(false); } } return(true); }
private static async Task <long> CreatePlayList(VideoCategory editedVideoCategory = null, string errorMessage = null) { editedVideoCategory = editedVideoCategory ?? new VideoCategory() { User_Id = UserData.CurrentUser.EntityId.Value }; var res = await UserDialogs.Instance.PromptAsync(errorMessage ?? "", "PCreate".GetString(), "Save".GetString(), "Cancel".GetString(), "PPlaceHolderName".GetString(), InputType.Name); errorMessage = ""; if (res.Ok) { if (string.IsNullOrEmpty(res.Text)) { return(await CreatePlayList(editedVideoCategory, "PPlaceHolderName".GetString() + " cannot be empty")); } if (UserData.VideoCategoryViews.Any(x => editedVideoCategory.EntityId != x.EntityId && string.Equals(x.Name, res.Text, StringComparison.OrdinalIgnoreCase))) { return(await CreatePlayList(editedVideoCategory, "PPlaceHolderName".GetString() + " already exist")); } editedVideoCategory.Name = res.Text; var id = await UserData.SaveCategory(editedVideoCategory); return(id); } else { return(-1); } }
public void Save_NormalCase() { const string url = "https://api.vk.com/method/video.save?name=Название из ютуба&description=Описание из ютуба&is_private=0&wallpost=1&link=https://www.youtube.com/watch?v=lhQtzv5a408&list=PLBC36AAAE4E4E0CAA&repeat=0&v=5.9&access_token=token"; const string json = @"{ 'response': { 'upload_url': 'http://cs6058.vk.com/upload.php?act=parse_share&hash=d5371f57b935d1b3b0c6cde1100ecb&rhash=5c623ee8b80db0d3af5078a5dfb2&mid=234695118&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DlhQtzv5a408&api_callback=06ec8115dfc9a66eec&remotely=1&photo_server=607423&photo_server_hash=7874a144e80b8bb3c1a1eee5c9043', 'video_id': 1673994, 'owner_id': 2346958, 'title': 'Название из ютуба', 'description': 'Описание из ютуба', 'access_key': 'f2ec9f3982f05bc' } }"; VideoCategory cat = GetMockedVideoCategory(url, json); Video v = cat.Save("Название из ютуба", "Описание из ютуба", isPostToWall: true, link: "https://www.youtube.com/watch?v=lhQtzv5a408&list=PLBC36AAAE4E4E0CAA"); v.Id.ShouldEqual(1673994); v.OwnerId.ShouldEqual(2346958); v.Title.ShouldEqual("Название из ютуба"); v.Description.ShouldEqual("Описание из ютуба"); v.AccessKey.ShouldEqual("f2ec9f3982f05bc"); v.UploadUrl.ShouldEqual(new Uri("http://cs6058.vk.com/upload.php?act=parse_share&hash=d5371f57b935d1b3b0c6cde1100ecb&rhash=5c623ee8b80db0d3af5078a5dfb2&mid=234695118&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DlhQtzv5a408&api_callback=06ec8115dfc9a66eec&remotely=1&photo_server=607423&photo_server_hash=7874a144e80b8bb3c1a1eee5c9043")); }
public ActionResult VideoCategoryDelete(int ID) { VideoCategory d = new VideoCategory(); d.VideoCategoryID = ID; d.delete(); return(RedirectToAction("VideoCategoryList")); }
public ActionResult CreateVideoCategory(VideoCategory videoCategory) { this.videoRepository.AddCategory(videoCategory); this.ViewData["categoyName"] = videoCategory.Name; return(this.RedirectToAction("CategoryCreated")); }
public ActionResult DeleteConfirmed(int id) { VideoCategory videoCategory = db.VideoCategories.Find(id); db.VideoCategories.Remove(videoCategory); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Update(VideoCategoryDTO VideoCategoryDTO) { VideoCategory VideoCategory = _VideoCategoryService.GetByID(VideoCategoryDTO.ID); VideoCategory.Name = VideoCategoryDTO.Name; VideoCategory.Explanation = VideoCategoryDTO.Explanation; _VideoCategoryService.Update(VideoCategory); return(Redirect("/SysAdmin/VideoCategory/List")); }
public static Attachment CreateAttachment( Guid zuneMediaId, MediaType mediaType, string title, VideoCategory videoCategory, MovieType movieType) { return(CreateAttachment(zuneMediaId, mediaType, -1, title, null, videoCategory, movieType)); }
public ActionResult VideoCategoryInsert(FormCollection collection) { VideoCategory d = new VideoCategory(); d.CategoryName = collection["CategoryName"]; d.insert(); return(RedirectToAction("VideoCategoryList")); }
public ActionResult AddVideo(Video video, VideoCategory category) { video.Uploader = this.userRepository.GetUserByName(this.User.Identity.Name); video.VideoCategory = this.videoRepository.GetCategoryById(category.Id); this.videoRepository.AddVideo(video); return(this.RedirectToAction("UploadSuccessFull")); }
public ActionResult VideoCategoryEdit(int id) { VideoCategory d = new VideoCategory(); d.VideoCategoryID = id; d.SelectByID(); return(View(d)); }
public void GetComments_WithLikes() { const string url = "https://api.vk.com/method/video.getComments?video_id=166481021&owner_id=1&need_likes=1&count=2&offset=3&sort=asc&v=5.9&access_token=token"; const string json = @"{ 'response': { 'count': 2146, 'items': [ { 'id': 14715, 'from_id': 24758120, 'date': 1384867361, 'text': 'паша здаров!', 'likes': { 'count': 5, 'user_likes': 0, 'can_like': 1 } }, { 'id': 14716, 'from_id': 94278436, 'date': 1384867372, 'text': 'Я опять на странице Дурова, опять передаю привет Маме, Бабушке и своим друзьям! Дела у меня очень отлично!', 'likes': { 'count': 77, 'user_likes': 0, 'can_like': 1 } } ] } }"; VideoCategory cat = GetMockedVideoCategory(url, json); ReadOnlyCollection <Comment> comments = cat.GetComments(166481021, 1, true, 2, 3, CommentsSort.Asc); comments.Count.ShouldEqual(2); comments[0].Id.ShouldEqual(14715); comments[0].FromId.ShouldEqual(24758120); comments[0].Date.ShouldEqual(new DateTime(2013, 11, 19, 17, 22, 41)); comments[0].Text.ShouldEqual("паша здаров!"); comments[0].Likes.Count.ShouldEqual(5); comments[0].Likes.UserLikes.ShouldEqual(false); comments[0].Likes.CanLike.ShouldEqual(true); comments[1].Id.ShouldEqual(14716); comments[1].FromId.ShouldEqual(94278436); comments[1].Date.ShouldEqual(new DateTime(2013, 11, 19, 17, 22, 52)); comments[1].Text.ShouldEqual("Я опять на странице Дурова, опять передаю привет Маме, Бабушке и своим друзьям! Дела у меня очень отлично!"); comments[1].Likes.Count.ShouldEqual(77); comments[1].Likes.UserLikes.ShouldEqual(false); comments[1].Likes.CanLike.ShouldEqual(true); }
public ActionResult Edit([Bind(Include = "VidCatId,VidCatName,AgeRestricted")] VideoCategory videoCategory) { if (ModelState.IsValid) { db.Entry(videoCategory).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(videoCategory)); }
public JObject SaveOrderNo(int Id, int OrderNo) { //VideoCategory ObjCategory = Category; VideoCategory OBJvideo = VideoCategory.GetOne(Id); OBJvideo.OrderNo = OrderNo; OBJvideo.UpdateOrderNo(); return(JObject.FromObject(OBJvideo)); }
public MVideoCategory(VideoCategory category) { Id = category.Id; if (category.Snippet == null) { return; } ChannelId = category.Snippet.ChannelId; Title = category.Snippet.Title; }
internal VideoCategoryExtended(VideoCategory videoCategory, VkApi vk) { _video = videoCategory; _vk = vk; }
/// <summary> /// Инициализирует новый экземпляр класса <see cref="VkApi"/>. /// </summary> public VkApi() { Browser = new Browser(); Users = new UsersCategory(this); Friends = new FriendsCategory(this); Status = new StatusCategory(this); Messages = new MessagesCategory(this); Groups = new GroupsCategory(this); Audio = new AudioCategory(this); Wall = new WallCategory(this); Database = new DatabaseCategory(this); Utils = new UtilsCategory(this); Fave = new FaveCategory(this); Video = new VideoCategory(this); Account = new AccountCategory(this); Photo = new PhotoCategory(this); Docs = new DocsCategory(this); Likes = new LikesCategory(this); RequestsPerSecond = 3; MaxCaptchaRecognitionCount = 5; AutoTokenRefresh = false; }
/// <summary> /// Инициализирует новый экземпляр класса <see cref="VkApi"/>. /// </summary> public VkApi() { Browser = new Browser(); Users = new UsersCategory(this); Friends = new FriendsCategory(this); Status = new StatusCategory(this); Messages = new MessagesCategory(this); Groups = new GroupsCategory(this); Audio = new AudioCategory(this); Wall = new WallCategory(this); Database = new DatabaseCategory(this); Utils = new UtilsCategory(this); Fave = new FaveCategory(this); Video = new VideoCategory(this); Account = new AccountCategory(this); Photo = new PhotoCategory(this); }