コード例 #1
0
        public IEnumerable <Booking> UpdateStatus(int id, string username)
        {
            _eventLoggerService.LogEvent(username, "update-booking-status");
            var booking = _ticketSystemDbContext.Booking.Find(id);

            booking.Status = "Paid";
            _ticketSystemDbContext.Booking.Update(booking);
            _ticketSystemDbContext.SaveChanges();

            return(Get());
        }
コード例 #2
0
        public string addStudent(string name, string cell, string email, string location, string isAdmin, string createdBy)
        {
            string results = CheckEntries(name, cell, email, location, isAdmin);

            if (results.Equals("true"))
            {
                SendConfirmationEmail(name, email);
                _eventLoggerService.LogEvent(createdBy, "new student");
                int userId = _ticketSystemDbContext.Users.Count() + 1;
                _ticketSystemDbContext.Users.Add(new Users()
                {
                    Id       = userId,
                    Name     = name,
                    Password = "******",
                    IsAdmin  = isAdmin == "Yes"? 1: 0,
                });

                _ticketSystemDbContext.Students.Add(new Students()
                {
                    Id            = userId,
                    Name          = name,
                    Cell          = cell,
                    Email         = email,
                    Location      = location,
                    PaymentStatus = "Unpaid",
                    Image         = ""
                });
                _ticketSystemDbContext.SaveChanges();
            }
            return(results);
        }
コード例 #3
0
        public ((IEnumerable <Movies> movies, IEnumerable <Select> options), string error) AddMovie(string name, int price, string url, string username)
        {
            string error = checkEntries(name, price, url);

            if (error == "true")
            {
                _eventLoggerService.LogEvent(username, "add-movie");
                _ticketSystemDbContext.Movies.Add(new Movies()
                {
                    Name  = name,
                    Price = price,
                    Image = url,
                });
                _ticketSystemDbContext.SaveChanges();
            }

            return(Get(), error);
        }