public virtual ActionResult Editar(TMovie model) { model.Update(); TMovieCategory.SaveCategories(model); TempData["Alerta"] = new Alert("success", "Filme alterado com sucesso"); return(RedirectToAction("Index")); }
public virtual ActionResult Excluir(int id, object diff) { TMovieCategory.Delete(x => x.Movie.Id == id); TMovie.Delete(id); TempData["Alerta"] = new Alert("success", "Filme excluído com sucesso"); return(RedirectToAction("Index")); }
public virtual ActionResult Excluir(int id, object diff) { TReservation.Delete(x => x.Id == id); TMovie.Delete(x => x.Id == id); TIten.Delete(id); return(RedirectToAction("Index")); }
public virtual ActionResult Reservar() { var reserva = new TReservation(); ViewBag.Movie = TMovie.ListAll().ToSelectList(x => x.Id, x => x.Name); return(View(reserva)); }
public static void outputTime(TMovie time) { int minutes = time.PlayTime % 60; int hors = (time.PlayTime - minutes) / 60; Console.Write("Время просмотра:{0}мин или {1}ч и {2}мин", time.PlayTime, hors, minutes); }
public virtual ActionResult Editar(int id) { var itens = new TIten(); ViewBag.Reservation = TReservation.ListAll().ToSelectList(x => x.Id, x => x.Id); ViewBag.Movie = TMovie.ListAll().ToSelectList(x => x.Id, x => x.Id); return(View()); }
public virtual ActionResult Cadastrar() { var reserva = new TReservation(); ViewBag.Client = TClient.ListAll().ToSelectList(x => x.Id, x => x.Name); ViewBag.Iten = TMovie.ListAll().ToSelectList(x => x.Id, x => x.Name); return(View(reserva)); }
public virtual ActionResult Cadastrar() { var filme = new TMovie(); ViewBag.EnumFormatMovie = EnumHelper.ListAll <FormatMovie>().ToSelectList(x => x, x => x.Description()); ViewBag.EnumTypeMovie = EnumHelper.ListAll <TypeMovie>().ToSelectList(x => x, x => x.Description()); ViewBag.Category = TCategory.ListAll().ToSelectList(x => x.Id, x => x.Name); return(View(filme)); }
public virtual ActionResult Editar(int id) { var reserva = TReservation.Load(id); ViewBag.Client = TClient.ListAll().ToSelectList(x => x.Id, x => x.Name); ViewBag.Iten = TMovie.ListAll().ToSelectList(x => x.Id, x => x.Name); ViewBag.Sale = TSale.ListAll().ToSelectList(x => x.Id, x => x.EnumStatusSale); return(View(reserva)); }
public virtual ActionResult Editar(int id) { var filme = TMovie.Load(id); var categoriasFilme = filme.TMovieCategories.Select(x => x.Category.Id).ToList(); ViewBag.EnumFormatMovie = EnumHelper.ListAll <FormatMovie>().ToSelectList(x => x, x => x.Description()); ViewBag.EnumTypeMovie = EnumHelper.ListAll <TypeMovie>().ToSelectList(x => x, x => x.Description()); ViewBag.Category = TCategory.List(x => !categoriasFilme.Contains(x.Id)).ToSelectList(x => x.Id, x => x.Name); return(View(filme)); }
public void SaveCategories(TMovie model) { TMovieCategory.Delete(x => x.Movie.Id == model.Id); for (int i = 0; i < model.Categories.Length; i++) { new TMovieCategory() { Movie = model, Category = TCategory.Load(model.Categories[i]) }.Save(); } }
public void SaveIten(TReservation model) { TIten.Delete(x => x.Movie.Id == model.Id); if (model.Iten != null) { for (int i = 0; i < model.itensdareserva.Length; i++) { new TIten() { Reservation = model, Movie = TMovie.Load(model.itensdareserva[i]) }.Save(); } } }
public virtual ActionResult Editar(TIten model) { try { TempData["Alert"] = new Alert("success", "Seu item foi editado com sucesso"); model.Save(); return(RedirectToAction("Index")); } catch (SimpleValidationException ex) { ViewBag.Reservation = TReservation.ListAll().ToSelectList(x => x.Id, x => x.Id); ViewBag.Movie = TMovie.ListAll().ToSelectList(x => x.Id, x => x.Id); return(HandleViewException(model, ex)); } }
public virtual ActionResult cliente_filmes() { List <TMovie> filmes; var client = (TClient)ViewBag.Cliente; var preferencias = client.TPreferences.Select(x => x.Category.Id).ToList(); if (preferencias.Count != 0) { filmes = TMovieCategory.List(x => preferencias.Contains(x.Category.Id)).Select(x => x.Movie).ToList(); } else { filmes = TMovie.ListAll().ToList(); } return(View(filmes)); }
public static string outputTime(TMovie time) { int minutes = time.PlayTime % 60; int hors = (time.PlayTime - minutes) / 60; string temp = $"Время просмотра: {time.PlayTime}мин или {hors}ч и {minutes}мин\n"; if (time.PlayTime > 120) { temp += "Фильм слишком длинный"; } if (time.PlayTime < 50) { temp += "Фильм слишком короткий"; } return(temp); }
public virtual ActionResult Cadastrar(TMovie model) { try { model.Date = DateTime.Now.GetCurrent(); model.Save(); TMovieCategory.SaveCategories(model); TempData["Alerta"] = new Alert("success", "Filme cadastrado com sucesso"); return(RedirectToAction("Index")); } catch (SimpleValidationException ex) { ViewBag.EnumFormatMovie = EnumHelper.ListAll <FormatMovie>().ToSelectList(x => x, x => x.Description()); ViewBag.EnumTypeMovie = EnumHelper.ListAll <TypeMovie>().ToSelectList(x => x, x => x.Description()); return(HandleViewException(model, ex)); } }
public virtual ActionResult Index() { var filmes = TMovie.ListAll().ToList(); return(View(filmes)); //var filmes2 = TMovieCategory.List(x => x.Category.Id == 5).Select(x => x.Movie); //TClient.List(x => x.Name == "Pedro"); //TClient.List(x => x.Name.StartsWith("m")); //TClient.List(x => x.Name.EndsWith("l")); //TClient.List(x => x.Name.Contains("silva")); //TReservation.List(x => x.Client.Name.StartsWith("p")); //TUser.Delete(x => x.Name.EndsWith("u")); //TClient.Delete(x => x.Name.StartsWith("pedro") || x.Name.EndsWith("silva")); //TClient.List(x => Name.StartsWith("Maria") && Name.EndsWith("João")); //TReservation.Delete(x => x.Client.Id == cliente.Id); //TPreference.Delete(x => x.Client.Name.Contains("João")); //TMovie.List(x => x.IsActive != false && x.Stock > 0); }
public void SaveMovies(TReservation model) { TIten.Delete(x => x.Reservation.Id == model.Id); if (model.Movies != null) { for (int i = 0; i < model.Movies.Length; i++) { var movie = TMovie.Load(model.Movies[i]); new TIten() { Reservation = model, Movie = movie, Value = movie.Value.Value, Quantity = model.Quantities[i] }.Save(); } } }
public static void Main(string[] args) { TMovie temp; string endResult = ""; StreamWriter save = new StreamWriter("C:\\Users\\Павел\\Documents\\GitHub\\ne_spisivay\\Практика_Структуры\\Практика_Структуры\\Save\\save.txt"); Console.Write("Введите кол-во фильмов: "); int a = int.Parse(Console.ReadLine()); TMovie[] film = new TMovie[a]; for (int i = 0; i < a; i++) { temp = inputStruct(); endResult += outputStruct(temp); endResult += outputTime(temp); film[i] = temp; } Console.Write(endResult); save.WriteLine(endResult); save.Close(); Console.ReadKey(); }
private void bAddMovie_Click(object sender, EventArgs e) { try { // Checks if textbox fields are valid int year = Convert.ToInt16(tbYearAdd.Text); String title = tbTitleAdd.Text; if (title.Trim() == String.Empty) throw new ArgumentException("Please input the movie title"); String director = tbDirectorAdd.Text; if (director.Trim() == String.Empty) throw new ArgumentException("Please input the movie director"); // Adds movie to the table TMovie movie = new TMovie(year, title, director); movieTable.Add(movie.year, movie); // Alert for confirmation MessageBox.Show("Movie Saved", "Add"); // Clears the textbox fields tbYearAdd.Text = ""; tbTitleAdd.Text = ""; tbDirectorAdd.Text = ""; } catch (ArgumentException ex) { MessageBox.Show(ex.Message, "Add"); } catch (FormatException ex) { MessageBox.Show("Please input the year of the movie", "Add"); } }
public static string outputStruct(TMovie output) { return($"Режисер:{output.Author}\nНазвание:{output.Name}\nГод выпуска:{output.Year}\n"); }
public virtual ActionResult Excluir(int id) { var filme = TMovie.Load(id); return(PartialView("_excluir", filme)); }
public static void outputStruct(TMovie output) { Console.WriteLine("Режисер:{0}\nНазвание:{1}\nГод выпуска:{2}\n", output.Author, output.Name, output.Year); }
public virtual ActionResult ListarFilmesSelecionados(string term) { return(Json(TMovie.List(x => x.Name.Contains(term)).Select(a => new { label = a.Name }), JsonRequestBehavior.AllowGet)); }
public virtual ActionResult ListarFilmes(int id) { var filmes = TMovie.Load(id); return(PartialView("_listar-filmes", filmes)); }
public virtual ActionResult Index() { var filmes = TMovie.ListAll().ToList(); return(View(filmes)); }