Exemplo n.º 1
0
 public void CreateComment(Comment comment)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         uow.CommentRepository.Create(comment);
     }
 }
Exemplo n.º 2
0
 public int CreateRequest(Request request)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         return uow.RequestRepository.Create(request);
     }
 }
Exemplo n.º 3
0
 public List<Request> GetAllRequestsByCreatorID(int creatorId)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         return uow.RequestRepository.GetAllRequestsByCreatorId(creatorId).ToList();
     }
 }
Exemplo n.º 4
0
 public List<Comment> GetAllCommentsByRequestId(int requestId)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         return uow.CommentRepository.GetAllCommentsByRequestId(requestId).ToList();
     }
 }
Exemplo n.º 5
0
 public void CreateCar(Car car)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         uow.CarRepository.Create(car);
     }
 }
Exemplo n.º 6
0
 public void CreateUser(User user)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         uow.UserRepository.Create(user);
     }
 }
Exemplo n.º 7
0
 public List<Car> GetAllCars()
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         return uow.CarRepository.GetAllCars().ToList();
     }
 }
Exemplo n.º 8
0
 public List<Request> GetAllRequests()
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         return uow.RequestRepository.GetAllRequests().ToList();
     }
 }
Exemplo n.º 9
0
 public Request GetRequestById(int id)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         var request = uow.RequestRepository.GetRequestById(id);
         return request;
     }
 }
Exemplo n.º 10
0
 public List<User> GetAllDrivers()
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         var userList = uow.UserRepository.GetUsersByRole((int) RolesEnum.Driver);
         return userList.ToList();
     }
 }
Exemplo n.º 11
0
 public List<Driver> GetAllDrivers()
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         var drivers = uow.DriverRepository.GetAllDrivers();
         return drivers.ToList();
     }
 }
Exemplo n.º 12
0
 public List<User> GetAllUsersByStatus(int status)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         var users = uow.UserRepository.GetAllUsersByStatus(status);
         return users.ToList();
     }
 }
Exemplo n.º 13
0
 public List<Request> GetAllRequestsByStatus(int status)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         var requestList = uow.RequestRepository.GetAllRequestsByStatus(status);
         return requestList.ToList();
     }
 }
Exemplo n.º 14
0
 public User GetUserById(int id)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         var user = uow.UserRepository.GetUserById(id);
         return user;
     }
 }
Exemplo n.º 15
0
 public Car GetCarById(int id)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         var car = uow.CarRepository.GetCarById(id);
         return car;
     }
 }
Exemplo n.º 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);
            }
        }
Exemplo n.º 17
0
 public User GetUserByLoginAndPassword(string login, string password)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         return uow.UserRepository.GetUserByLogInAndPassword(login, password);
     }
 }
Exemplo n.º 18
0
 public bool IsLoginBookedByOtherId(string login, int id)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         var isBooked = uow.UserRepository.IsLoginBookedByOtherId(login, id);
         return isBooked;
     }
 }
Exemplo n.º 19
0
 public bool IsCarIdBooked(int id)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         var isBooked = uow.CarRepository.IsCarIdBooked(id);
         return isBooked;
     }
 }
Exemplo n.º 20
0
 public List<User> GetUserByRole(int role)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         var users = uow.UserRepository.GetUsersByRole(role);
         return users.ToList();
     }
 }
Exemplo n.º 21
0
 public User GetUserByLogin(string login)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         var user = uow.UserRepository.GetUserByLogIn(login);
         return user;
     }
 }
Exemplo n.º 22
0
 public bool IsLoginBooked(string login)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         return uow.UserRepository.IsLoginBooked(login);
     }
 }
Exemplo n.º 23
0
 public void UpdateRequest(Request request)
 {
     using (var uow = new UnitOfWork(_appConfigConnection))
     {
         uow.RequestRepository.Update(request);
     }
 }