コード例 #1
0
        // GET: Home
        public ActionResult Index()
        {
            VMHome model = service.HomeModel();

            foreach (var d in model.DropDownProducts)
            {
                d.JsonGames = JsonConvert.SerializeObject(d.Games);
            }

            return(View("Index", model));
        }
コード例 #2
0
        // GET: Admin/Home
        public ActionResult Index()
        {
            VMHome vm = new VMHome()
            {
                KategoriSayisi   = db.Kategori.Count(),
                MakaleSayisi     = db.Makale.Count(),
                KullaniciSayisi  = db.Kullanici.Count(),
                KullaniciAdSoyad = db.Kullanici.Select(m => new { m.Kadi, m.AdSoyad }).FirstOrDefault(m => m.Kadi == User.Identity.Name).AdSoyad
            };

            return(View(vm));
        }
コード例 #3
0
        public IActionResult Index(string lang)
        {
            ViewBag.lang = lang;
            VMHome model = new VMHome()
            {
                AboutItems   = _context.HomeAboutItems.Take(6).ToList(),
                Facts        = _context.Facts.Take(4).ToList(),
                Posts        = _context.Posts.Include(p => p.PostWriter).OrderBy(p => p.CreatedDate).Take(3).ToList(),
                Products     = _context.Products.Include(p => p.ProductPhotos).Where(p => p.IsActive == true).OrderBy(p => p.ID).Take(8).ToList(),
                Projects     = _context.Projects.Include(p => p.ProjectPhotos).OrderBy(p => p.ID).Take(6).ToList(),
                ServiceItems = _context.ServiceItems.OrderBy(si => si.ID).Take(9).ToList()
            };

            return(View(model));
        }
コード例 #4
0
        public ActionResult Index()
        {
            VMHome homemodel = new VMHome();

            homemodel.Sliders     = db.Sliders.ToList();
            homemodel.Teachers    = db.Teachers.OrderByDescending(t => t.Id).Take(3).ToList();
            homemodel.Courses     = db.Courses.OrderByDescending(t => t.Id).Take(3).ToList();
            homemodel.Events      = db.Events.OrderByDescending(t => t.Id).Take(4).ToList();
            homemodel.Blogs       = db.Blogs.Include("User").OrderByDescending(t => t.Id).Take(3).ToList();
            homemodel.Common      = db.Commons.FirstOrDefault();
            homemodel.About       = db.Abouts.FirstOrDefault();
            homemodel.TestMorials = db.TestMorials.ToList();
            homemodel.TestMorial  = db.TestMorials.FirstOrDefault();

            return(View(homemodel));
        }
コード例 #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            VM = new VMHome();
            ISharedPreferences prefs    = GetSharedPreferences(GetString(Resource.String.preference_key_name), FileCreationMode.Private);
            string             username = prefs.GetString("username", null);
            string             password = prefs.GetString("password", null);
            Sesion             sesion   = ((CodorniXApplication)Application).GetSesion();

            if (sesion == null && username != null && password != null)
            {
                // Fast call to login
                Intent intent = new Intent(this, typeof(Login));
                intent.SetFlags(ActivityFlags.ClearTop);
                StartActivity(intent);
                Finish();
                return;
            }

            if (username == null || password == null)
            {
                CerrarSesion(null, null);
                return;
            }

            VM.ObtenerEncargado(sesion.uidUsuario);


            // Create your application here
            SetContentView(Resource.Layout.Home);

            Tareas        = FindViewById <ImageButton>(Resource.Id.btnTarea);
            Tareas.Click += OpenTareas;

            Asignaciones        = FindViewById <ImageButton>(Resource.Id.btnAsignaciones);
            Asignaciones.Click += OpenAsignaciones;

            Salir        = FindViewById <ImageButton>(Resource.Id.btnLogout);
            Salir.Click += CerrarSesion;

            Bienvenido      = FindViewById <TextView>(Resource.Id.bienvenido);
            Bienvenido.Text = "Bienvenido " + VM.Encargado.STRNOMBRE + ' ' + VM.Encargado.STRAPELLIDOPATERNO;
        }
コード例 #6
0
        public ActionResult Index()
        {
            var topics  = new List <VMTopic>();
            var topics1 = Topic.ListAllStarred(items => items.ForEach(x => topics.Add(new VMTopic
            {
                Id          = x.Id,
                Title       = x.Title,
                Slug        = x.Slug,
                Desc        = x.Description,
                Logo        = x.Icon == null ? Url.Content("~/assets/img/default.jpg") : x.Icon.Url(ImageFlags.S160X100),
                DateCreated = x.CreatedAt
            })));
            var vm = new VMHome
            {
                TopicNum = topics.Count,
                Topics   = topics.OrderBy(x => x.Slug).ToList()
            };

            //TODO:fake Login
            fakeLogin();
            return(View(vm));
        }
コード例 #7
0
        public VMHome HomeModel()
        {
            VMHome home = new VMHome();

            home.TopProducts      = new List <Product>();
            home.DropDownSizes    = dbContext.Sizes.ToList();
            home.DropDownProducts = new List <DropDownProduct>();

            foreach (var p in dbContext.Products)
            {
                DropDownProduct d = new DropDownProduct();
                d.Id    = p.ID;
                d.Name  = p.Name;
                d.Img   = p.Img;
                d.Games = new List <string>();

                foreach (var g in p.Size.Games)
                {
                    d.Games.Add(g.Name);
                }
                home.DropDownProducts.Add(d);
            }


            var products = from p in dbContext.Products
                           join s in dbContext.Sales on p.ID equals s.ProductID
                           where p.ID == s.ProductID
                           group p by new
            {
                Id     = p.ID,
                Name   = p.Name,
                Height = p.Size.Height,
                Width  = p.Size.Width,
                Img    = p.Img,
                Color  = p.Color,
                Price  = p.Price,
            } into gro

                select new
            {
                Id         = gro.Key.Id,
                Name       = gro.Key.Name,
                Height     = gro.Key.Height,
                Width      = gro.Key.Width,
                Img        = gro.Key.Img,
                TotalSales = dbContext.Sales.Where(y => y.ProductID == gro.Key.Id).Sum(x => x.Quantity),
                Color      = gro.Key.Color,
                Price      = gro.Key.Price,
            };

            foreach (var p in products.OrderByDescending(x => x.TotalSales).Take(3))
            {
                Product product = new Product();
                product.ID          = (int)p.Id;
                product.Name        = (string)p.Name;
                product.Color       = (string)p.Color;
                product.Size        = new Size();
                product.Size.Height = (int)p.Height;
                product.Size.Width  = (int)p.Width;
                product.Img         = (string)p.Img;
                product.Price       = (decimal)p.Price;

                home.TopProducts.Add(product);
            }

            return(home);
        }