Exemplo n.º 1
0
        public IActionResult Gezien(int id, HomeListViewModel item)
        {
            string userId = User.FindFirstValue(ClaimTypes.NameIdentifier);

            var gezien = new UserFilmGezienStatus()
            {
                FilmId         = id,
                UserId         = userId,
                GezienStatusId = int.Parse(item.Gezien)
            };

            try
            {
                _appContext.UserFilmGeziens.Add(gezien);

                _appContext.SaveChanges();
            }
            catch (Exception)
            {
                _appContext.UserFilmGeziens.Update(gezien);

                _appContext.SaveChanges();
            }
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 public ActionResult Index(int id = 0, int supplierID = 0)
 {
     Session["kategoriler"] = _categoryService.GetAll();
     if (id == 0 && supplierID == 0)
     {
         HomeListViewModel model = new HomeListViewModel()
         {
             Products   = _productService.GetAll(),
             Categories = _categoryService.GetAll(),
             Suppliers  = _supplierService.GetAll()
         };
         return(View(model));
     }
     else if (id != 0)
     {
         HomeListViewModel model = new HomeListViewModel()
         {
             Products   = _productService.GetAll().Where(x => x.CategoryID == id).ToList(),
             Categories = _categoryService.GetAll(),
             Suppliers  = _supplierService.GetAll()
         };
         return(View(model));
     }
     else if (supplierID != 0)
     {
         HomeListViewModel model = new HomeListViewModel()
         {
             Products   = _productService.GetAll().Where(x => x.SupplierID == supplierID).ToList(),
             Categories = _categoryService.GetAll(),
             Suppliers  = _supplierService.GetAll()
         };
         return(View(model));
     }
     return(RedirectToAction("Error"));
 }
Exemplo n.º 3
0
        public ActionResult Complaints()
        {
            HomeListViewModel model = new HomeListViewModel()
            {
                Complaint = new Complaint()
            };

            return(View(model));
        }
Exemplo n.º 4
0
        public ActionResult Detail(int id)
        {
            var product             = _productService.GetbyProduct(id);
            HomeListViewModel model = new HomeListViewModel()
            {
                Product = product,
                CurrentCategoryProduct = _productService.GetAll().Where(x => x.CategoryID == product.CategoryID).ToList()
            };

            return(View(model));
        }
Exemplo n.º 5
0
        [ResponseCache(CacheProfileName = "Home")]                                                 // L'output html prodotto da questa action può essere messo in cache. La duration si misura in secondi
        public async Task <IActionResult> Index([FromServices] ICachedCourseService courseService) //FromServices istruisce il controller a cercare l'istanza nei services, per una corretta dependency injection
        {
            HomeListViewModel homeListViewModel = new HomeListViewModel
            {
                BestCourses       = await courseService.GetBestCourseAsync(),
                MostRecentCourses = await courseService.GetMostRecentCourseAsync()
            };

            ViewData["Title"] = "E-Learning Demo";
            return(View(homeListViewModel));
        }
Exemplo n.º 6
0
        public IActionResult GetEmployee(int id)
        {
            HomeListViewModel objHLVM = new HomeListViewModel()
            {
                employee  = _employeeRepo.GetEmployee(id),
                PageTitle = "This is First View",
                Heading   = "Welcome to Comp world !"
            };

            return(View("List", objHLVM));
        }
Exemplo n.º 7
0
        public ActionResult Discount()
        {
            var products            = _productService.GetAll().Where(x => x.DiscountAvailable == true).ToList();
            HomeListViewModel model = new HomeListViewModel()
            {
                Products   = products,
                Categories = _categoryService.GetAll(),
                Suppliers  = _supplierService.GetAll()
            };

            return(View(model));
        }
Exemplo n.º 8
0
        public IActionResult ListResult()
        {
            var context = new mpmContext();
            var resList = context.Set <Data.Entities.mpm>().ToList();

            var model = new HomeListViewModel()
            {
                Mpms = resList
            };

            return(View(model));
        }
Exemplo n.º 9
0
        public ActionResult Index(string genre, int authorPage = 1, int bookPage = 1, int comBookPage = 1)
        {
            HomeListViewModel model = new HomeListViewModel
            {
                AuthorListViewModel     = GetAuthorListViewModel(authorPage),
                BookListViewModel       = GetBookListViewModel(genre, bookPage),
                CommonBookListViewModel = GetCommonBookListViewModel(comBookPage)
            };

            // var sss = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
            // var ssss = sss.Take(5).Union(sss.Skip(sss.Count - 3).Take(3).Reverse()).ToList();

            return(View(model));
        }
Exemplo n.º 10
0
        private HomeListViewModel GetItems(DateTime?inicio, DateTime?fim)
        {
            var data = new HomeListViewModel();

            data.items = _sheduleService.GetSchedulesByRange(inicio, fim).Select(x => new HomeListItemViewModel()
            {
                Id        = x.Id,
                Title     = x.Title,
                TimeStart = x.TimeStart,
                TimeEnd   = x.TimeEnd,
                Room      = x.Room,
                UserName  = x.User.UserName
            }).ToList();

            return(data);
        }
Exemplo n.º 11
0
        public ActionResult Index()
        {
            var programci = _programciService.GetAll();
            var kunyes    = _kunyeService.GetAll();
            var yayins    = _yayinService.GetAll();
            var vitrins   = _vitrinService.GetAll();
            var iletisims = _iletisimService.GetAll();
            var kurumsals = _kurumsalService.GetAll();
            var top30     = _top30Service.GetAll();

            HomeListViewModel model = new HomeListViewModel
            {
                Kunyes     = kunyes,
                Yayins     = yayins,
                Iletisims  = iletisims,
                Kurumsals  = kurumsals,
                Vitrins    = vitrins,
                Programcis = programci,
                Top30      = top30,
                Mesajs     = new Mesaj()
            };

            return(View(model));
        }
Exemplo n.º 12
0
        public ViewResult List(string Troop = null, string Discipline = "0")
        {
            //TODOНазвание дисциплины нужно для вывода оценок
            HomeListViewModel model = new HomeListViewModel
            {
                Students = repository_students.students.Where(ob => (ob.Troop.Number == Troop || Troop == null))
                           .OrderBy(ob => ob.FIO)
                           .ToArray(),
                Troop       = Troop,           // нах в модели мне номер взвода и дисциплина??
                Discipline  = Discipline,      // хотя как вариант выводить в их перед таблицей Взвод - Название дисциплины
                DaysArrival = new Troop().DaysArrival
            };

            //if(model.Students.First().Troop.Disciplines.Count() == 0)
            //{
            //	model.Students.First().Troop.TroopFactory();
            //}
            //foreach (var item in model.Students)
            //{
            //	item.Assessments = item.Assessments.Where(ob => ob.Theme.Discipline.Name == model.Discipline).ToList();
            //}

            return(View(model));
        }