Exemplo n.º 1
0
        public ActionResult EndHireComplete(string bref)
        {
            var hire = HireRepository.RetrieveSingleHire(bref);

            hire.HireUser       = UserRepository.RetrieveUser(hire.UserId);
            hire.HireUser.Score = TransactionRepository.GetUsersPoints(hire.UserId);
            return(View("EndHireComplete", hire));
        }
Exemplo n.º 2
0
        public ActionResult EndHire(int hireId)
        {
            var hire = HireRepository.RetrieveSingleHire(hireId);

            hire.HireUser = UserRepository.RetrieveUser(hire.UserId);

            return(View("EndHire", hire));
        }
Exemplo n.º 3
0
        public ActionResult Edit(string id)
        {
            var hire = HireRepository.RetrieveSingleHire(id);

            hire.HireUser = UserRepository.RetrieveUser(hire.UserId);

            return(View("SingleHire", hire));
        }
        public ActionResult Action(string bookingReference, string emailAddress, string userPassword)
        {
            var hire = HireRepository.RetrieveSingleHire(bookingReference, emailAddress);

            if (hire == null)
            {
                return(Redirect("/manage/NewUserRegister?notFound=true"));
            }

            var user = UserRepository.UpdatePassword(hire.UserId, userPassword);

            return(Redirect("/manage/NewUserRegister/Success"));
        }
Exemplo n.º 5
0
        public ActionResult EndHireAction(int hireId, int endMileage)
        {
            var hire = HireRepository.RetrieveSingleHire(hireId);

            if (hire == null || endMileage < hire.StartMileage)
            {
                return(Redirect($"/manage/Hire/EndHire?hireId={hireId}"));
            }

            hire = HireRepository.SetEndMileage(hireId, endMileage);

            TransactionRepository.CreateTransaction(hire.UserId, endMileage - hire.StartMileage, TransactionType.Mileage);

            return(Redirect($"/manage/Hire/EndHireComplete?bref={hire.BookingReference}"));
        }
Exemplo n.º 6
0
        public ActionResult NewHireAction(string bookingReference, string customerEmailAddress, string firstName, string surname, int startMileage)
        {
            var user = UserRepository.RetrieveUser(customerEmailAddress);

            if (user == null)
            {
                user = UserRepository.CreateUser(customerEmailAddress, firstName, surname);
            }

            var hire = HireRepository.RetrieveSingleHire(bookingReference);

            if (hire != null)
            {
                return(Redirect("/manage/Hire"));
            }
            else
            {
                hire = HireRepository.CreateHire(user.UserId, bookingReference, DateTime.MinValue, startMileage);
                return(Redirect($"/manage/Hire/Edit/{hire.BookingReference}"));
            }
        }