static public void setPlayer(sources source) { switch (source) { case sources.ArkVid: new Sources.ArkVid(player, DataHold.VideoList.Dequeue()); break; case sources.yUp: new Sources.yUp(player, DataHold.VideoList.Dequeue()); break; default: break; } }
public async Task <IActionResult> Post([FromBody] sources entity) { try { if (!isValid(entity)) { return(new BadRequestObjectResult("Object is invalid")); } var loggedInMember = LoggedInUser(); if (loggedInMember == null) { return(new BadRequestObjectResult("Invalid input parameters")); } entity.last_updated = DateTime.Now; entity.last_updated_by = loggedInMember.member_id; return(Ok(await agent.Add <sources>(entity))); } catch (Exception ex) { return(await HandleExceptionAsync(ex)); } }
// GET: sources public ActionResult Index(string searchText, string message, int?i, bool update = false, int id = 0) { if (searchText != null) { searchText = searchText.ToLower(); } ViewData["Titlessss"] = ""; string messageType = null; if (update && db.sources.Count((a) => a.id == id) == 1) { sources targetSource = db.sources.Find(id); if (targetSource != null) { ViewData["Issue"] = targetSource.journal_issue; ViewData["Volume"] = targetSource.journal_volume; ViewData["Titlessss"] = targetSource.item_title; ViewData["Update"] = update; ViewData["Id"] = id; } } if (message != null) { if (message == "Произошла ошибка или запись уже есть." || message == "Произошла непредвиденная ошибка." || message == "Произошла непредвиденная ошибка или такой источник уже есть.") { messageType = "danger"; } else { messageType = "success"; } ViewData["messageType"] = messageType; ViewData["message"] = message; } return(View((db.sources.Where(source => source.item_title.ToLower().Contains(searchText) || searchText == null)).OrderBy(x => x.item_title).ToList().ToPagedList(i ?? 1, 10))); }
// GET: sources/Delete/5 public ActionResult Delete(int?id) { string localMessage = null; try { if (id != null) { sources targetSource = db.sources.Find(id); if (targetSource != null) { db.sources.Remove(targetSource); db.SaveChanges(); localMessage = $"Запись {targetSource.item_title} была успешно удалена."; return(RedirectToAction("/Index", new { i = 1, message = localMessage })); } } } catch { } localMessage = "Произошла непредвиденная ошибка."; return(RedirectToAction("/Index", new { i = 1, message = localMessage })); }
public ActionResult Update(string titleInput, int idInput, int yearInput, string[] Authors, string Words, string Source, string Type, int issueInput = 0, int volumeInput = 0) { List <int> authorId = GetAuthors(Authors); string[] words = GetKeywords(Words); string localMessage = "Произошла непредвиденная ошибка или такая публикация уже есть."; try { if (ModelState.IsValid && db.publications.Count((a) => a.id == idInput) == 1 && db.publications.Count((a) => (a.title == titleInput) && (a.year == yearInput)) == 0) { publications targetPublication = db.publications.Find(idInput); localMessage = $"Запись {targetPublication.title} успешно изменена на {titleInput}."; targetPublication.title = titleInput; targetPublication.year = Convert.ToInt16(yearInput); foreach (authors au in targetPublication.authors) { au.publications.Remove(targetPublication); } targetPublication.authors.Clear(); foreach (int authorid in authorId) { authors a = db.authors.Find(authorid); if (a != null) { targetPublication.authors.Add(a); a.publications.Add(targetPublication); } } foreach (keywords kw in targetPublication.keywords) { kw.publications.Remove(targetPublication); } targetPublication.keywords.Clear(); foreach (string keyword in words) { keywords k = db.keywords.Where(x => x.keyword == keyword).FirstOrDefault(); if (k == null) { int k_id = db.keywords.Count(); while (db.keywords.Count((a) => a.id == k_id) == 1) { k_id++; } k = new keywords(); k.id = k_id; k.keyword = keyword; db.keywords.Add(k); db.SaveChanges(); } targetPublication.keywords.Add(k); k.publications.Add(targetPublication); } foreach (sources so in targetPublication.sources) { so.publications.Remove(targetPublication); } targetPublication.sources.Clear(); sources s = db.sources.Where(x => x.item_title == Source).FirstOrDefault(); if (s != null) { targetPublication.sources.Add(s); if (issueInput > 0 && volumeInput > 0) { s.journal_issue = issueInput; s.journal_volume = volumeInput; } else { s.journal_issue = null; s.journal_volume = null; } s.publications.Add(targetPublication); } foreach (types ty in targetPublication.types) { ty.publications.Remove(targetPublication); } targetPublication.types.Clear(); types t = db.types.Where(x => x.type_name == Type).FirstOrDefault(); if (t != null) { targetPublication.types.Add(t); t.publications.Add(targetPublication); } db.Entry(targetPublication).State = EntityState.Modified; db.SaveChanges(); } } catch { } return(RedirectToAction("/Index", new { i = 1, message = localMessage })); }
public ActionResult Create(string titleInput, int yearInput, string[] Authors, string Words, string Source, string Type, int issueInput = 0, int volumeInput = 0) { string localMessage = "Произошла ошибка или запись уже есть."; List <int> authorId = GetAuthors(Authors); string[] words = GetKeywords(Words); try { if (ModelState.IsValid && db.publications.Count((a) => a.title == titleInput) == 0 && authorId.Count != 0) { int current_id = db.publications.Count(); while (db.publications.Count((a) => a.id == current_id) == 1) { current_id++; } publications newPublication = new publications(); newPublication.id = current_id; newPublication.title = titleInput; newPublication.year = Convert.ToInt16(yearInput); foreach (int authorid in authorId) { authors a = db.authors.Find(authorid); if (a != null) { newPublication.authors.Add(a); a.publications.Add(newPublication); } } foreach (string keyword in words) { keywords k = db.keywords.Where(x => x.keyword == keyword).FirstOrDefault(); if (k == null) { int k_id = db.keywords.Count(); while (db.keywords.Count((a) => a.id == k_id) == 1) { k_id++; } k = new keywords(); k.id = k_id; k.keyword = keyword; db.keywords.Add(k); db.SaveChanges(); } newPublication.keywords.Add(k); k.publications.Add(newPublication); } sources s = db.sources.Where(x => x.item_title == Source).FirstOrDefault(); if (s != null) { newPublication.sources.Add(s); if (issueInput > 0 && volumeInput > 0) { s.journal_issue = issueInput; s.journal_volume = volumeInput; } else { s.journal_issue = null; s.journal_volume = null; } s.publications.Add(newPublication); } types t = db.types.Where(x => x.type_name == Type).FirstOrDefault(); if (t != null) { newPublication.types.Add(t); t.publications.Add(newPublication); } db.publications.Add(newPublication); db.SaveChanges(); localMessage = $"Запись {titleInput} успешно добавлена."; } } catch { } return(RedirectToAction("/Index", new { i = 1, message = localMessage })); }
return(GetSolution(sources, additionalFiles, additionalMetadataReferences, ToEditorConfig(editorConfig)));
ValidateAndThrowExceptionIfArgumentError(sources, func, concurrency);
VerifyDiagnostics(sources, LanguageNames.CSharp, GetCSharpDiagnosticAnalyzer(), expected);
Msmt(sources, targets, cost, bound, max);
=> await VerifyCodeFixAsync(sources, DiagnosticResult.EmptyDiagnosticResults, fixedSources);
public static IEnumerable <annotate> annotate(this sources obj) => obj.Items.OfType <annotate>();
public static IEnumerable <import> import(this sources obj) => obj.Items.OfType <import>();