public async Task <ActionResult> Edit(string id) { HzgWebService svc = new HzgWebService(); NewEditMovieModel model = new NewEditMovieModel(); // damit wir wieder auf die richtige Seite zurück finden if (Request.Params.AllKeys.Contains("ReturnUri")) { ViewBag.ReturnUri = Request.Params["ReturnUri"]; } else { ViewBag.ReturnUri = "/Movie/Index"; } var movie = await svc.GetMovieById(id); if (movie == null) { return(RedirectToAction("Index")); } model.Movie = movie; model.Mode = Mode.Edit; /* Genre und Mediumtype Listen initialisieren */ await InitGenreMediumtypes(model, svc); return(View(model)); }
public async Task <ActionResult> Delete(string id) { try { HzgWebService svc = new HzgWebService(); var movie = await svc.GetMovieById(id); if (movie != null) { await svc.DeleteMovie(movie); } return(RedirectToAction("Index")); } catch { return(View()); } }