示例#1
0
        public async Task <IActionResult> Service()
        {
            ViewModelClasses viewModel = new ViewModelClasses()
            {
                Feedbacks  = new Feedbacks(),
                _Complaint = _context.Complaints.FirstOrDefault(),
                _CV        = _context.CVs.FirstOrDefault()
            };

            if (User.Identity.IsAuthenticated)
            {
                string currentuser = "";
                var    userAuth    = await _userManager.FindByEmailAsync(HttpContext.User.Identity.Name);

                currentuser = userAuth.Id;
                viewModel.Feedbacks.Like = (from feed in _context.Feedbacks
                                            where feed.UserId == currentuser
                                            select feed.Like).FirstOrDefault();

                viewModel.Feedbacks.DisLike = (from feed in _context.Feedbacks
                                               where feed.UserId == currentuser
                                               select feed.DisLike).FirstOrDefault();
            }

            viewModel.Feedbacks.LikeCount = _context.Feedbacks.Select(x => x.LikeCount).Sum();

            ViewBag.Status = Status.Stat;

            Status.Stat = "empty";

            return(View(viewModel));
        }
示例#2
0
        public async Task <IActionResult> CV(ViewModelClasses model)
        {
            var _cv = model._CV;

            if (User.Identity.IsAuthenticated)
            {
                var UserEmail = await _userManager.FindByEmailAsync(HttpContext.User.Identity.Name);

                _cv.UserId = UserEmail.Id;

                if (UserEmail.ToString() != _cv.Email)
                {
                    return(RedirectToAction("WarningPage", "Home"));
                }
            }
            if (_cv.CV_File == null)
            {
                ModelState.AddModelError("", "file sould be selected");
                return(View("Service", model));
            }
            _cv.CV_Name = await _cv.CV_File.SaveAsync(_env.WebRootPath, "img", "cv");

            _context.CVs.Add(_cv);
            await _context.SaveChangesAsync();

            Status.Stat = "success";
            return(RedirectToAction("Service", "Home"));
        }
示例#3
0
        public IActionResult Register()
        {
            ViewModelClasses view = new ViewModelClasses()
            {
                RegisterModel = new RegisterModel()
            };

            return(View(view));
        }
示例#4
0
        public IActionResult LoginUser()
        {
            ViewModelClasses viewModel = new ViewModelClasses()
            {
                LoginModel = new LoginModel()
            };

            return(View(viewModel));
        }
示例#5
0
        public IActionResult Create()
        {
            ViewModelClasses viewModel = new ViewModelClasses()
            {
                Categories = _context.Categories.ToList(),
                Product    = new Product()
            };

            return(View(viewModel));
        }
示例#6
0
        public ActionResult Index()
        {
            var vm = new ViewModelClasses()
            {
                Gallery = _db.Galleries.ToList(),
                About   = _db.Abouts.ToList(),
                Event   = _db.Events.ToList()
            };

            return(View(vm));
        }
示例#7
0
        public IActionResult Contact()
        {
            ViewBag.Status = Status.Stat;

            Status.Stat = "empty";

            ViewModelClasses viewModel = new ViewModelClasses()
            {
                Contacts = _context.Contacts.FirstOrDefault()
            };

            return(View(viewModel));
        }
示例#8
0
        //Blog
        public async Task <IActionResult> Blog(string lang)
        {
            ViewBag.lang = lang;

            var length     = _context.Blogs.Count();
            int pageLength = length / 3;

            ViewBag.blogLength = pageLength;
            var vm = new ViewModelClasses()
            {
                Blogs = await _context.Blogs.Take(3).ToListAsync()
            };

            return(View(vm));
        }
示例#9
0
        //Index GET
        public async Task <IActionResult> Index(string lang)
        {
            ViewBag.lang = lang;

            ViewBag.aboutPage = "About";

            ViewModelClasses viewModel = new ViewModelClasses()
            {
                Sliders      = await _context.Sliders.ToListAsync(),
                About        = _context.Abouts.FirstOrDefault(),
                Testimonials = await _context.Testimonials.ToListAsync(),
                WhyChooseUs  = await _context.WhyChooseUs.ToListAsync()
            };

            return(View(viewModel));
        }
        public async Task <IActionResult> Index()
        {
            var viewModel = new ViewModelClasses()
            {
                Header       = await _context.Headers.ToListAsync(),
                NewArrival   = await _context.NewArrivals.OrderByDescending(d => d.Date).ToListAsync(),
                Products     = await _context.Products.Where(d => d.Price < 35 && d.Price > 20).ToListAsync(),
                ProductRated = await _context.Products.Take(3).ToListAsync(),
                OurBlog      = await _context.OurBlogs.ToListAsync(),
                UserProduct  = await _context.UserProducts.ToListAsync()
            };

            if (User.Identity.IsAuthenticated)
            {
                var a = await _userManager.FindByNameAsync(HttpContext.User.Identity.Name);

                ViewBag.userid = a.Id;
            }
            return(View(viewModel));
        }
示例#11
0
        public IActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var product = _context.Products.Find(id);

            if (product == null)
            {
                return(NotFound());
            }
            ViewModelClasses viewModel = new ViewModelClasses()
            {
                Categories = _context.Categories.ToList(),
                Product    = product
            };

            return(View(viewModel));
        }
        public async Task <IActionResult> Wishlist()
        {
            string alkazer = "";

            if (User.Identity.IsAuthenticated)
            {
                var a = await _userManager.FindByNameAsync(HttpContext.User.Identity.Name);

                alkazer        = a.Id;
                ViewBag.userid = a.Id;
            }

            //string currentUser = _userManager.GetUserAsync(HttpContext.User).Id.ToString();
            //ViewBag.currentUser = currentUser;
            var viewModel = new ViewModelClasses
            {
                //Products = await _context.Products.ToListAsync(),
                UserProduct = await _context.UserProducts.Where(x => x.ApplicationUser.Id == alkazer).ToListAsync()
            };

            return(View(viewModel));
        }
        public async Task <ActionResult> ProductBlogDetails(int?id)
        {
            if (id == null)
            {
                return(NotFound("Bele bir Id tapilmadi"));
            }

            var ourBlog = _context.OurBlogs.Find(id);

            if (ourBlog == null)
            {
                return(NotFound("Bele bir Id tapilmadi"));
            }

            ViewModelClasses viewModel = new ViewModelClasses()
            {
                Categories = await _context.Categories.ToListAsync(),
                OurBlogs   = ourBlog
            };

            return(View(viewModel));
        }
        public async Task <ActionResult> ProductDetails(int?id)
        {
            if (id == null)
            {
                return(NotFound("Bele bir Id tapilmadi"));
            }

            var product = _context.Products.Find(id);

            if (product == null)
            {
                return(NotFound("Bele bir Id tapilmadi"));
            }

            ViewModelClasses viewModel = new ViewModelClasses()
            {
                Categories = await _context.Categories.ToListAsync(),
                Category   = new Models.Category(),
                Product    = product
            };

            return(View(viewModel));
        }