Exemplo n.º 1
0
        public IActionResult BiletAl(int sefer_id, int user_id, double fiyat)
        {
            Tickets bilet = new Tickets();

            bilet.SeatNumber   = 1;
            bilet.Status       = true;
            bilet.UserId       = user_id;
            bilet.ExpeditionId = sefer_id;
            bilet.TicketPrice  = fiyat;
            _context.Add(bilet);
            _context.SaveChanges();

            Expeditions sefer = new Expeditions();

            sefer = _context.Expeditions.Where(x => x.Id == sefer_id).FirstOrDefault();

            int biletSayısı = _context.Tickets.Where(x => x.ExpeditionId == sefer_id && x.Status == true).Count();

            if (biletSayısı % 5 == 0)
            {
                double yeniFiyat = sefer.Price + ((sefer.Price * 10) / 100);
                sefer.Price = yeniFiyat;
                _context.SaveChanges();
            }
            int id = user_id;

            string message = "Biletiniz Alındı...";

            return(RedirectToAction("Index", "Home", new { id, message }));
        }
Exemplo n.º 2
0
        public ActionResult Iptal(int id)
        {
            Tickets bilet = new Tickets();

            bilet        = _context.Tickets.Where(x => x.Id == id).FirstOrDefault();
            bilet.Status = false;
            _context.SaveChanges();
            return(RedirectToAction("BiletList", "Admin", new { area = "" }));
        }
Exemplo n.º 3
0
        public ActionResult KullaniciOlustur(string UserName, string UserSurname, string Email, string Password)
        {
            Users usr = new Users();

            usr.Email       = Email;
            usr.Password    = Password;
            usr.UserName    = UserName;
            usr.UserSurname = UserSurname;
            _context.Add(usr);
            _context.SaveChanges();
            int      intIdt  = _context.Users.Max(u => u.Id);
            UserRole usrRole = new UserRole();

            usrRole.RoleId = 2;
            usrRole.UserId = intIdt;
            _context.Add(usrRole);
            _context.SaveChanges();
            return(View("Index"));
        }