Beispiel #1
0
 public void CreateComment(Comment comment)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         uow.CommentRepository.Create(comment);
     }
 }
Beispiel #2
0
 public int CreateRequest(Request request)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         return uow.RequestRepository.Create(request);
     }
 }
Beispiel #3
0
 public List<Request> GetAllRequestsByCreatorID(int creatorId)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         return uow.RequestRepository.GetAllRequestsByCreatorId(creatorId).ToList();
     }
 }
Beispiel #4
0
 public List<Comment> GetAllCommentsByRequestId(int requestId)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         return uow.CommentRepository.GetAllCommentsByRequestId(requestId).ToList();
     }
 }
Beispiel #5
0
 public void CreateCar(Car car)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         uow.CarRepository.Create(car);
     }
 }
Beispiel #6
0
 public void CreateUser(User user)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         uow.UserRepository.Create(user);
     }
 }
Beispiel #7
0
 public List<Car> GetAllCars()
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         return uow.CarRepository.GetAllCars().ToList();
     }
 }
Beispiel #8
0
 public List<Request> GetAllRequests()
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         return uow.RequestRepository.GetAllRequests().ToList();
     }
 }
Beispiel #9
0
 public Request GetRequestById(int id)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         var request = uow.RequestRepository.GetRequestById(id);
         return request;
     }
 }
Beispiel #10
0
 public List<User> GetAllDrivers()
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         var userList = uow.UserRepository.GetUsersByRole((int) RolesEnum.Driver);
         return userList.ToList();
     }
 }
Beispiel #11
0
 public List<Driver> GetAllDrivers()
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         var drivers = uow.DriverRepository.GetAllDrivers();
         return drivers.ToList();
     }
 }
Beispiel #12
0
 public List<User> GetAllUsersByStatus(int status)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         var users = uow.UserRepository.GetAllUsersByStatus(status);
         return users.ToList();
     }
 }
Beispiel #13
0
 public List<Request> GetAllRequestsByStatus(int status)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         var requestList = uow.RequestRepository.GetAllRequestsByStatus(status);
         return requestList.ToList();
     }
 }
Beispiel #14
0
 public User GetUserById(int id)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         var user = uow.UserRepository.GetUserById(id);
         return user;
     }
 }
Beispiel #15
0
 public Car GetCarById(int id)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         var car = uow.CarRepository.GetCarById(id);
         return car;
     }
 }
Beispiel #16
0
        public void UpdateRequest(Request request)
        {
            var oldRequest = this.GetRequestById(request.Id);

            if ((oldRequest.Status == (int)RequestStatusEnum.Active && request.Status == (int)RequestStatusEnum.Closed)
                || (oldRequest.Status == (int)RequestStatusEnum.InProgress && request.Status == (int)RequestStatusEnum.Active)
                || (oldRequest.Status == (int)RequestStatusEnum.Rejected && request.Status == (int)RequestStatusEnum.Active)
                || (oldRequest.Status == (int)RequestStatusEnum.Rejected && request.Status == (int)RequestStatusEnum.InProgress)
                || (oldRequest.Status == (int)RequestStatusEnum.Rejected && request.Status == (int)RequestStatusEnum.Closed)
                || (oldRequest.Status == (int)RequestStatusEnum.Closed && request.Status == (int)RequestStatusEnum.Active)
                || (oldRequest.Status == (int)RequestStatusEnum.Closed && request.Status == (int)RequestStatusEnum.InProgress)
                || (oldRequest.Status == (int)RequestStatusEnum.Closed && request.Status == (int)RequestStatusEnum.Rejected))
            {
                throw new ArgumentException("Wrong parametrs for request update");
            }
            using (var uow = new UnitOfWork(_appConfigConnection)){

                uow.RequestRepository.Update(request);
            }
        }
Beispiel #17
0
 public User GetUserByLoginAndPassword(string login, string password)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         return uow.UserRepository.GetUserByLogInAndPassword(login, password);
     }
 }
Beispiel #18
0
 public bool IsLoginBookedByOtherId(string login, int id)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         var isBooked = uow.UserRepository.IsLoginBookedByOtherId(login, id);
         return isBooked;
     }
 }
Beispiel #19
0
 public bool IsCarIdBooked(int id)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         var isBooked = uow.CarRepository.IsCarIdBooked(id);
         return isBooked;
     }
 }
Beispiel #20
0
 public List<User> GetUserByRole(int role)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         var users = uow.UserRepository.GetUsersByRole(role);
         return users.ToList();
     }
 }
Beispiel #21
0
 public User GetUserByLogin(string login)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         var user = uow.UserRepository.GetUserByLogIn(login);
         return user;
     }
 }
Beispiel #22
0
 public bool IsLoginBooked(string login)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         return uow.UserRepository.IsLoginBooked(login);
     }
 }
Beispiel #23
0
 public void UpdateRequest(Request request)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         uow.RequestRepository.Update(request);
     }
 }