Пример #1
0
        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));
        }
Пример #2
0
        public virtual ActionResult Editar(int id)
        {
            var cliente      = TClient.Load(id);
            var preferencias = cliente.TPreferences.Select(x => x.Category.Id).ToList();

            ViewBag.MostraSenha       = false;
            ViewBag.EnumProfileClient = EnumHelper.ListAll <ProfileClient>().ToSelectList(x => x, x => x.Description());
            if (preferencias.Count != 0)
            {
                ViewBag.Category = TCategory.List(x => !preferencias.Contains(x.Id)).ToSelectList(x => x.Id, x => x.Name);
            }
            else
            {
                ViewBag.Category = TCategory.ListAll().ToSelectList(x => x.Id, x => x.Name);
            }
            return(View(cliente));
        }