public IActionResult SearchXes(IndexModelView model) { ViewData["MauXeId"] = new SelectList(_context.MauXe, "MauXeId", "TenMauXe"); ViewData["TinhId"] = new SelectList(_context.Tinh, "TinhId", "TenTinh"); ViewData["DongXeId"] = new SelectList(_context.DongXe, "DongXeId", "TenDongXe"); ViewData["LoaiXeId"] = new SelectList(_context.LoaiXe, "LoaiXeId", "TenLoaiXe"); ViewData["NhaSanXuatId"] = new SelectList(_context.NhaSanXuat, "NhaSanXuatId", "TenNSX"); var indexModelView = new IndexModelView(); if (model.SearchXeViewModel.SearchAll == true) { var mau = _context.MauXe.Find(model.SearchXeViewModel.MauXeId).TenMauXe; indexModelView.Xes = _context.Xe.Include(x => x.DongXe).ThenInclude(l => l.NhaSanXuat) .Include(x => x.LoaiXe).Include(x => x.Tinh).Where(a => a.LoaiXeId == model.SearchXeViewModel.LoaiXeId) .Include(x => x.DongXe).ThenInclude(l => l.MauDongXe).Where(a => a.DongXeId == model.SearchXeViewModel.DongXeId && a.Mau == mau) .Where(c => c.TinhId == model.SearchXeViewModel.TinhId).ToList(); } else { indexModelView.Xes = _context.Xe.Include(x => x.DongXe).ThenInclude(l => l.NhaSanXuat) .Include(x => x.LoaiXe).Include(x => x.Tinh) .Include(x => x.DongXe).ThenInclude(l => l.MauDongXe) .Where(c => c.TinhId == model.SearchXeViewModel.TinhId).ToList(); } return(View(indexModelView)); }
public ActionResult Index() { using (var entities = new scrumDatabaseEntities()) { var model = new IndexModelView { Henkilot = entities.Henkilot.Take(1).ToList(), Tyot = entities.Tyot.Take(1).ToList(), Tunnit = entities.Tunnit.Take(1).ToList() }; return(View(model)); } // scrumDatabaseEntities entities = new scrumDatabaseEntities(); // entities .Henkilot = scrumDatabaseEntities.He ////Vanhat Asiat ////scrumDatabaseEntities entities = new scrumDatabaseEntities(); ////dynamic model = new ExpandoObject(); ////model.Henkilot = entities.Henkilot.ToList(); ////model.Tyot = entities.Tyot.ToList(); ////model.Tunnit = entities.Tunnit.ToList(); //ViewBag.Henkilot = entities.Henkilot.FirstOrDefault(x => x.HenkiloId == someId); //List<Henkilot> model = entities.Henkilot.ToList(); //entities.Dispose(); //return View(); }
// GET: Index public ActionResult Index() { IndexModelView imv = new IndexModelView(); imv.Posts = (from p in repository.News orderby p.Date descending select p).Take(3).ToList(); imv.Students = (from e in db.Students orderby e.LastName descending select e).ToList(); imv.Events = (from e in db.Event orderby e.EventDate descending select e).ToList(); imv.Teachers = (from m in db.Teachers orderby m.LastName ascending select m).Take(5).ToList(); ViewBag.Members = db.Teachers.Count(); ViewBag.Students = db.Students.Count(); return(View(imv)); }
public ActionResult Index(int id) { IndexModelView model = new IndexModelView(); if (!User.Identity.IsAuthenticated) { return(RedirectToAction("Login", "Account", null)); } return(View(model)); }
// GET: Xes public async Task <IActionResult> Index() { var indexModelView = new IndexModelView(); indexModelView.Xes = _context.Xe.Include(x => x.DongXe).ThenInclude(l => l.NhaSanXuat) .Include(x => x.LoaiXe).Include(x => x.Tinh).ToList(); ViewData["MauXeId"] = new SelectList(_context.MauXe, "MauXeId", "TenMauXe"); ViewData["TinhId"] = new SelectList(_context.Tinh, "TinhId", "TenTinh"); ViewData["DongXeId"] = new SelectList(_context.DongXe, "DongXeId", "TenDongXe"); ViewData["LoaiXeId"] = new SelectList(_context.LoaiXe, "LoaiXeId", "TenLoaiXe"); ViewData["NhaSanXuatId"] = new SelectList(_context.NhaSanXuat, "NhaSanXuatId", "TenNSX"); return(View(indexModelView)); }
public IActionResult Index() { DataContext context = new DataContext(); //IEnumerable<Product> products = context.Products; List <ProductModel> products = new List <ProductModel>();// context.Products.ToList(); foreach (var item in context.Products.ToList()) { products.Add(item); } IndexModelView modelView = new IndexModelView(products); return(View(modelView)); }
public ActionResult Index() { var modelView = new IndexModelView { MetaTag = new SiteMetaTag { CurrentUrl = Url.CurrentUrl(), Description = "VNStyle Tattoo Studio cơ sở xăm uy tín với đội ngũ nghệ nhân chuyên nghiệp", Image = Url.HostContent("~/Content/images/logo-big-dark.png"), Keywords = "VNStyle Tattoo, xăm uy tín, xam uy tin, tha thu, tattoo", Publisher = "Phong Hua Dai", ContentCreatedDate = DateTime.Now } }; //var a = _articleService.GetFeaturedFirst(); return(View(modelView)); }
// GET: Home public ActionResult Index() { IndexModelView vm = new IndexModelView(); if (string.IsNullOrEmpty(vm.selectedLanguge)) { vm.Text = Resouces.Resource.Lang; } if (vm.selectedLanguge.Equals("English")) { vm.Text = Resouces.Resource.Lang; } if (vm.selectedLanguge.Equals("Marathi")) { vm.Text = Resouces.Resource_MR.Lang; } return(View(vm)); }
public ActionResult Index(int id = 0, int id2 = 0, string id3 = "") { IndexModelView model = new IndexModelView(); if (!User.Identity.IsAuthenticated) { return(RedirectToAction("Login", "Account", null)); } //busca as ultimas compras ViewBag.mes = System.Globalization.DateTimeFormatInfo.CurrentInfo.GetMonthName(DateTime.Now.Month); ViewBag.msg = id3; return(View(model)); }
public async Task <IActionResult> Index(IndexModelView inputModal) { if (!ModelState.IsValid) { return(View()); } var user = new IdentityUser { UserName = inputModal.Email, Email = inputModal.Email }; var result = await _userManager.CreateAsync(user, inputModal.Password); if (result.Succeeded) { var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); var callbackUrl = Url.Page( "/Account/ConfirmEmail", pageHandler: null, values: new { userId = user.Id, code = code }, protocol: Request.Scheme); await _emailSender.SendEmailAsync(inputModal.Email, "Confirm your email", $"Please confirm your account by <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>clicking here</a>."); await _signInManager.SignInAsync(user, isPersistent : false); Shop shop = new Shop { Name = inputModal.ShopName, TradingCode = inputModal.TradingCode, Address = inputModal.Address, UserId = user.Id }; await _dbContext.AddAsync(shop); await _dbContext.SaveChangesAsync(); } if (!result.Succeeded) { ModelState.AddModelError("EmailExisted", "Your email is in use!"); } return(View(inputModal)); }
// GET: Transaction public ActionResult Index() { DataTable dtblProduct = new DataTable(); DataTable best_seller = new DataTable(); DataTable warning_stock = new DataTable(); DataTable total_transaction = new DataTable(); DataTable total_product = new DataTable(); DataTable todays_transaction = new DataTable(); DataTable todays_income = new DataTable(); DataTable all_income = new DataTable(); DataTable total_stock = new DataTable(); using (SqlConnection sqlCon = new SqlConnection(connectionString)) { sqlCon.Open(); SqlDataAdapter sqlDa = new SqlDataAdapter("select TransactionTable.TransactionID, TransactionTable.TransactionNumber, ProductTable.ProductName, ProductTable.Price, TransactionTable.Quantity, TransactionTable.Total from TransactionTable INNER JOIN ProductTable ON TransactionTable.ProductID = ProductTable.ProductID", sqlCon); sqlDa.Fill(dtblProduct); } using (SqlConnection sqlCon2 = new SqlConnection(connectionString)) { sqlCon2.Open(); SqlDataAdapter sqlDa2 = new SqlDataAdapter("SELECT Best_Seller_Product.ProductID, Best_Seller_Product.Produk_Terlaris, ProductTable.ProductName FROM Best_Seller_Product INNER JOIN ProductTable ON ProductTable.ProductID = Best_Seller_Product.ProductID", sqlCon2); sqlDa2.Fill(best_seller); } using (SqlConnection sqlCon3 = new SqlConnection(connectionString)) { sqlCon3.Open(); SqlDataAdapter sqlDa3 = new SqlDataAdapter("SELECT * FROM ProductTable WHERE ProductTable.Stock <= 10", sqlCon3); sqlDa3.Fill(warning_stock); } using (SqlConnection sqlCon4 = new SqlConnection(connectionString)) { sqlCon4.Open(); SqlDataAdapter sqlDa4 = new SqlDataAdapter("SELECT COUNT(TransactionTable.ProductID) AS Total_Transaction FROM TransactionTable ", sqlCon4); sqlDa4.Fill(total_transaction); } using (SqlConnection sqlCon5 = new SqlConnection(connectionString)) { sqlCon5.Open(); SqlDataAdapter sqlDa5 = new SqlDataAdapter("SELECT COUNT(ProductTable.ProductName) AS TotalProduct FROM ProductTable", sqlCon5); sqlDa5.Fill(total_product); } using (SqlConnection sqlCon6 = new SqlConnection(connectionString)) { sqlCon6.Open(); SqlDataAdapter sqlDa6 = new SqlDataAdapter("SELECT COUNT(DateOfTransaction.TransactionID) AS TransactionToday FROM DateOfTransaction", sqlCon6); sqlDa6.Fill(todays_transaction); } using (SqlConnection sqlCon7 = new SqlConnection(connectionString)) { sqlCon7.Open(); SqlDataAdapter sqlDa7 = new SqlDataAdapter("SELECT SUM(DateOfTransaction.Total) AS todays_income FROM DateOfTransaction", sqlCon7); sqlDa7.Fill(todays_income); } using (SqlConnection sqlCon8 = new SqlConnection(connectionString)) { sqlCon8.Open(); SqlDataAdapter sqlDa8 = new SqlDataAdapter("SELECT SUM(TransactionTable.Total) AS all_income FROM TransactionTable", sqlCon8); sqlDa8.Fill(all_income); } using (SqlConnection sqlCon9 = new SqlConnection(connectionString)) { sqlCon9.Open(); SqlDataAdapter sqlDa9 = new SqlDataAdapter("SELECT SUM(Stock) AS TotalStock FROM ProductTable", sqlCon9); sqlDa9.Fill(total_stock); } var Table = new IndexModelView(); Table.Table1 = dtblProduct; Table.Table2 = best_seller; Table.Table3 = warning_stock; Table.Table4 = total_transaction; Table.Table5 = total_product; Table.Table6 = todays_transaction; Table.Table7 = todays_income; Table.Table8 = all_income; Table.Table9 = total_stock; return(View(Table)); }