public async Task <ActionResult> NewBook() { ViewBag.Tab = "Desk"; ViewBag.Genres = GenreCache.GetAll(); ViewBag.Languages = LanguagesCache.GetAll(); var user = await GetCurrentUserAsync(); var newBookKey = Guid.NewGuid(); //_service.StartANewBook(user); return(RedirectToAction("Book", "Desk", new { key = newBookKey })); }
internal async System.Threading.Tasks.Task <Genres> GetGenre(long ger) { if (GenreCache.TryGetValue(ger, out Genres genre)) { return(genre); } var jsonResult = await webclient.DownloadStringTaskAsync("https://api-endpoint.igdb.com/" + "genres/" + ger); var ge = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Genres> >(jsonResult)[0]; GenreCache.Add(ger, ge); return(ge); }
// GET: /Desk/Book public async Task <ActionResult> Book(string key, string message) { ViewBag.Key = key; ViewBag.Tab = "Desk"; ViewBag.SubTab = "Book"; ViewBag.Genres = GenreCache.GetAll(); ViewBag.Languages = LanguagesCache.GetAll(); if (!string.IsNullOrEmpty(message)) { ViewBag.StatusMessage = message; } return(View(new BookModel()));// _service.GetBookByKey(key)); }