public void CreateComment(Comment comment) { using (var uow = new UnitOfWork(_appConfigConnection)) { uow.CommentRepository.Create(comment); } }
public int CreateRequest(Request request) { using (var uow = new UnitOfWork(_appConfigConnection)) { return uow.RequestRepository.Create(request); } }
public List<Request> GetAllRequestsByCreatorID(int creatorId) { using (var uow = new UnitOfWork(_appConfigConnection)) { return uow.RequestRepository.GetAllRequestsByCreatorId(creatorId).ToList(); } }
public List<Comment> GetAllCommentsByRequestId(int requestId) { using (var uow = new UnitOfWork(_appConfigConnection)) { return uow.CommentRepository.GetAllCommentsByRequestId(requestId).ToList(); } }
public void CreateCar(Car car) { using (var uow = new UnitOfWork(_appConfigConnection)) { uow.CarRepository.Create(car); } }
public void CreateUser(User user) { using (var uow = new UnitOfWork(_appConfigConnection)) { uow.UserRepository.Create(user); } }
public List<Car> GetAllCars() { using (var uow = new UnitOfWork(_appConfigConnection)) { return uow.CarRepository.GetAllCars().ToList(); } }
public List<Request> GetAllRequests() { using (var uow = new UnitOfWork(_appConfigConnection)) { return uow.RequestRepository.GetAllRequests().ToList(); } }
public Request GetRequestById(int id) { using (var uow = new UnitOfWork(_appConfigConnection)) { var request = uow.RequestRepository.GetRequestById(id); return request; } }
public List<User> GetAllDrivers() { using (var uow = new UnitOfWork(_appConfigConnection)) { var userList = uow.UserRepository.GetUsersByRole((int) RolesEnum.Driver); return userList.ToList(); } }
public List<Driver> GetAllDrivers() { using (var uow = new UnitOfWork(_appConfigConnection)) { var drivers = uow.DriverRepository.GetAllDrivers(); return drivers.ToList(); } }
public List<User> GetAllUsersByStatus(int status) { using (var uow = new UnitOfWork(_appConfigConnection)) { var users = uow.UserRepository.GetAllUsersByStatus(status); return users.ToList(); } }
public List<Request> GetAllRequestsByStatus(int status) { using (var uow = new UnitOfWork(_appConfigConnection)) { var requestList = uow.RequestRepository.GetAllRequestsByStatus(status); return requestList.ToList(); } }
public User GetUserById(int id) { using (var uow = new UnitOfWork(_appConfigConnection)) { var user = uow.UserRepository.GetUserById(id); return user; } }
public Car GetCarById(int id) { using (var uow = new UnitOfWork(_appConfigConnection)) { var car = uow.CarRepository.GetCarById(id); return car; } }
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); } }
public User GetUserByLoginAndPassword(string login, string password) { using (var uow = new UnitOfWork(_appConfigConnection)) { return uow.UserRepository.GetUserByLogInAndPassword(login, password); } }
public bool IsLoginBookedByOtherId(string login, int id) { using (var uow = new UnitOfWork(_appConfigConnection)) { var isBooked = uow.UserRepository.IsLoginBookedByOtherId(login, id); return isBooked; } }
public bool IsCarIdBooked(int id) { using (var uow = new UnitOfWork(_appConfigConnection)) { var isBooked = uow.CarRepository.IsCarIdBooked(id); return isBooked; } }
public List<User> GetUserByRole(int role) { using (var uow = new UnitOfWork(_appConfigConnection)) { var users = uow.UserRepository.GetUsersByRole(role); return users.ToList(); } }
public User GetUserByLogin(string login) { using (var uow = new UnitOfWork(_appConfigConnection)) { var user = uow.UserRepository.GetUserByLogIn(login); return user; } }
public bool IsLoginBooked(string login) { using (var uow = new UnitOfWork(_appConfigConnection)) { return uow.UserRepository.IsLoginBooked(login); } }
public void UpdateRequest(Request request) { using (var uow = new UnitOfWork(_appConfigConnection)) { uow.RequestRepository.Update(request); } }