/// <summary> /// Remove the selected media on the favorite playlist /// </summary> /// <param name="sender"></param> private void removeMediaMethod(object sender) { if (ListOfMedia.Count == 1) { ListOfMedia.RemoveAt(0); IsRemoveMediaEnabled = false; SelectedIndex = 0; } else if (ListOfMedia.Count > 1) { if (SelectedIndex >= ListOfMedia.Count) { SelectedIndex = ListOfMedia.Count - 1; } else if (SelectedIndex < 0) { SelectedIndex = 0; } ListOfMedia.RemoveAt(SelectedIndex); IsRemoveMediaEnabled = true; } else { IsRemoveMediaEnabled = false; } }
public async Task <IActionResult> History(int id = 0) { ListOfMedia lm = _context.ListOfMedia.Find(id); ViewBag.SMI = lm.NameRus + " - история перерегистрации"; var applicationDbContext = _context.ListOfMediaHistory.Where(x => x.ListOfMediaId == id).Include(l => l.DictFinSource).Include(l => l.DictLegalForm).Include(l => l.DictMediaFreqRelease).Include(l => l.DictMediaLangType).Include(l => l.DictMediaType); return(View(await applicationDbContext.ToListAsync())); }
public async Task <IActionResult> Create([Bind("Id,NameRus,NameKyrg,DictLegalFormId,INN,RegistrationDate,Name,Territoryy,DictMediaLangTypeId,DictMediaTypeId,AddressRus,AddressKyrg,DictMediaFreqReleaseId,DictFinSourceId,ReregistrationDate,EliminationDate,CreateDate,ApplicationUserId")] ListOfMedia listOfMedia) { if (ModelState.IsValid) { _context.Add(listOfMedia); await _context.SaveChangesAsync(); HistoryInsert(listOfMedia); return(RedirectToAction(nameof(Index))); } ViewData["DictFinSourceId"] = new SelectList(_context.DictFinSource, "Id", "NameRus", listOfMedia.DictFinSourceId); ViewData["DictLegalFormId"] = new SelectList(_context.DictLegalForm, "Id", "NameRus", listOfMedia.DictLegalFormId); ViewData["DictMediaFreqReleaseId"] = new SelectList(_context.DictMediaFreqRelease, "Id", "NameRus", listOfMedia.DictMediaFreqReleaseId); ViewData["DictMediaLangTypeId"] = new SelectList(_context.DictMediaLangType, "Id", "NameRus", listOfMedia.DictMediaLangTypeId); ViewData["DictMediaTypeId"] = new SelectList(_context.DictMediaType, "Id", "NameRus", listOfMedia.DictMediaTypeId); return(View(listOfMedia)); }
public async Task <IActionResult> Create([Bind("Id,NameRus,NameKyrg,INN,RegistrationDate,Name,DictLangMediaTypeId,DictMediaTypeId,AddressRus,AddressKyrg,DictDistrictId,DictMediaFreqReleaseId,DictMediaFinSourceId,ReregistrationDate,EliminationDate,NumberOfPermission,PermissionDate,DictAgencyPermId,DateOfPay,NumOfPermGas,PermGASDate,PermElimGASDate")] ListOfMedia listOfMedia) { if (ModelState.IsValid) { _context.Add(listOfMedia); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DictAgencyPermId"] = new SelectList(_context.Set <DictAgencyPerm>(), "Id", "NameRus"); ViewData["DictDistrictId"] = new SelectList(_context.DictDistrict, "Id", "NameRus"); ViewData["DictLangMediaTypeId"] = new SelectList(_context.DictLangMediaType, "Id", "NameRus"); ViewData["DictMediaFinSourceId"] = new SelectList(_context.DictMediaFinSource, "Id", "NameRus"); ViewData["DictMediaFreqReleaseId"] = new SelectList(_context.DictMediaFreqRelease, "Id", "NameRus"); ViewData["DictMediaTypeId"] = new SelectList(_context.DictMediaType, "Id", "NameRus"); ViewData["DictDistribTerritoryMediaId"] = new SelectList(_context.DictDistribTerritoryMedia, "Id", "NameRus"); ViewData["DictRegionId"] = new SelectList(_context.DictRegion, "Id", "NameRus"); ViewData["DictLegalFormId"] = new SelectList(_context.DictLegalForm, "Id", "NameRus"); return(View(listOfMedia)); }
// GET: Media/ListOfMedias/Create public IActionResult Create() { ViewData["DictFinSourceId"] = new SelectList(_context.DictFinSource, "Id", "NameRus"); ViewData["DictLegalFormId"] = new SelectList(_context.DictLegalForm, "Id", "NameRus"); ViewData["DictMediaFreqReleaseId"] = new SelectList(_context.DictMediaFreqRelease, "Id", "NameRus"); ViewData["DictMediaLangTypeId"] = new SelectList(_context.DictMediaLangType, "Id", "NameRus"); ViewData["DictMediaTypeId"] = new SelectList(_context.DictMediaType, "Id", "NameRus"); string uid = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; ListOfMedia model = new ListOfMedia(); model.CreateDate = DateTime.Now; model.NameKyrg = "NULL"; model.AddressKyrg = "NULL"; model.ApplicationUserId = uid; return(View(model)); }
/// <summary> /// Add new media to the favorite playlist /// </summary> /// <param name="sender"></param> private void addMediaMethod(object sender) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Audio files (*.mp3 *.wav *.flac *.ogg)|*.mp3; *.wav; *.flac; *.ogg|Video files (*.mp4 *.avi *.flv *.wmv *.mov)|*.mp4; *.avi; *.flv; *.wmv; *.mov|All files (*.*)|*.*"; if (openFileDialog.ShowDialog() == true) { IsRemoveMediaEnabled = true; MediaSingleElement selectedMedia = new MediaSingleElement(); selectedMedia.Title = Path.GetFileNameWithoutExtension(openFileDialog.FileName); selectedMedia.mediaUri = openFileDialog.FileName; var ffProbe = new NReco.VideoInfo.FFProbe(); var videoInfo = ffProbe.GetMediaInfo(openFileDialog.FileName); selectedMedia.MediaDuration = videoInfo.Duration.ToString(@"mm\:ss"); ListOfMedia.Add(selectedMedia); selectedMedia.Extension = Path.GetExtension(openFileDialog.FileName); getIconImage(selectedMedia, selectedMedia.Extension); } }
public async Task <IActionResult> Edit(int id, [Bind("Id,NameRus,NameKyrg,DictLegalFormId,INN,RegistrationDate,Name,Territoryy,DictMediaLangTypeId,DictMediaTypeId,AddressRus,AddressKyrg,DictMediaFreqReleaseId,DictFinSourceId,ReregistrationDate,EliminationDate,CreateDate, ApplicationUserId")] ListOfMedia listOfMedia, string SubmitButton = "") { if (id != listOfMedia.Id) { return(NotFound()); } if (ModelState.IsValid) { try { string uid = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; listOfMedia.ApplicationUserId = uid; if (SubmitButton == "Перерегистрация") { HistoryInsert(listOfMedia); } _context.Update(listOfMedia); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ListOfMediaExists(listOfMedia.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DictFinSourceId"] = new SelectList(_context.DictFinSource, "Id", "NameRus", listOfMedia.DictFinSourceId); ViewData["DictLegalFormId"] = new SelectList(_context.DictLegalForm, "Id", "NameRus", listOfMedia.DictLegalFormId); ViewData["DictMediaFreqReleaseId"] = new SelectList(_context.DictMediaFreqRelease, "Id", "NameRus", listOfMedia.DictMediaFreqReleaseId); ViewData["DictMediaLangTypeId"] = new SelectList(_context.DictMediaLangType, "Id", "NameRus", listOfMedia.DictMediaLangTypeId); ViewData["DictMediaTypeId"] = new SelectList(_context.DictMediaType, "Id", "NameRus", listOfMedia.DictMediaTypeId); return(View(listOfMedia)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,NameRus,NameKyrg,INN,RegistrationDate,Name,DictLangMediaTypeId,DictMediaTypeId,AddressRus,AddressKyrg,DictDistrictId,DictMediaFreqReleaseId,DictMediaFinSourceId,ReregistrationDate,EliminationDate,NumberOfPermission,PermissionDate,DictAgencyPermId,DateOfPay,NumOfPermGas,PermGASDate,PermElimGASDate")] ListOfMedia listOfMedia) { if (id != listOfMedia.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(listOfMedia); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ListOfMediaExists(listOfMedia.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DictAgencyPermId"] = new SelectList(_context.Set <DictAgencyPerm>(), "Id", "NameRus"); ViewData["DictDistrictId"] = new SelectList(_context.DictDistrict, "Id", "NameRus"); ViewData["DictLangMediaTypeId"] = new SelectList(_context.DictLangMediaType, "Id", "NameRus"); ViewData["DictMediaFinSourceId"] = new SelectList(_context.DictMediaFinSource, "Id", "NameRus"); ViewData["DictMediaFreqReleaseId"] = new SelectList(_context.DictMediaFreqRelease, "Id", "NameRus"); ViewData["DictMediaTypeId"] = new SelectList(_context.DictMediaType, "Id", "NameRus"); ViewData["DictDistribTerritoryMediaId"] = new SelectList(_context.DictDistribTerritoryMedia, "Id", "NameRus"); ViewData["DictRegionId"] = new SelectList(_context.DictRegion, "Id", "NameRus"); ViewData["DictLegalFormId"] = new SelectList(_context.DictLegalForm, "Id", "NameRus"); return(View(listOfMedia)); }
private void HistoryInsert(ListOfMedia listOfMedia) { ListOfMediaHistory lh = new ListOfMediaHistory(); lh.AddressKyrg = listOfMedia.AddressKyrg; lh.AddressRus = listOfMedia.AddressRus; lh.CreateDate = DateTime.Now; lh.DictMediaFinSourceId = listOfMedia.DictFinSourceId; lh.DictMediaFreqReleaseId = listOfMedia.DictMediaFreqReleaseId; lh.DictMediaLangTypeId = listOfMedia.DictMediaLangTypeId; lh.DictMediaTypeId = listOfMedia.DictMediaTypeId; lh.EliminationDate = listOfMedia.EliminationDate; lh.INN = listOfMedia.INN; lh.ListOfMediaId = listOfMedia.Id; lh.Name = listOfMedia.Name; lh.NameKyrg = listOfMedia.NameKyrg; lh.NameRus = listOfMedia.NameRus; lh.RegistrationDate = listOfMedia.RegistrationDate; lh.ReregistrationDate = listOfMedia.ReregistrationDate; lh.Territoryy = listOfMedia.Territoryy; _context.ListOfMediaHistory.Add(lh); _context.SaveChanges(); }