Beispiel #1
0
        /// <summary>
        /// Favourites the installer.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns></returns>
        public async Task <bool> FavouriteInstaller(string id)
        {
            using (var db = new MancobaLocalDataApi(_connectionFactory, _platformCapabilities))
            {
                await db.FavouriteInstaller(id);

                return(true);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Gets the street.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns></returns>
        public async Task <ModelStreet> GetStreet(string id)
        {
            using (var db = new MancobaLocalDataApi(_connectionFactory, _platformCapabilities))
            {
                var response = await db.GetStreet(id);

                return(response.ToModel());
            }
        }
Beispiel #3
0
        /// <summary>
        /// Gets the provider products.
        /// </summary>
        /// <param name="providerId">The provider identifier.</param>
        /// <returns></returns>
        public async Task <List <ModelProviderProduct> > GetProviderProducts(string providerId)
        {
            using (var db = new MancobaLocalDataApi(_connectionFactory, _platformCapabilities))
            {
                var response = await db.GetProviderProducts(providerId);

                return(response.ToModelCollection());
            }
        }
Beispiel #4
0
        /// <summary>
        /// Checks the in.
        /// </summary>
        /// <returns></returns>
        public async Task <bool> CheckIn()
        {
            using (var db = new MancobaLocalDataApi(_connectionFactory, _platformCapabilities))
            {
                var response = await db.CheckIn(_systemUser.Id);

                return(response > 0);
            }
        }
Beispiel #5
0
        /// <summary>
        /// Pings this instance.
        /// </summary>
        /// <returns></returns>
        public async Task <bool> Ping()
        {
            using (var db = new MancobaLocalDataApi(_connectionFactory, _platformCapabilities))
            {
                var response = await db.Ping();

                return(response > 0);
            }
        }
Beispiel #6
0
        /// <summary>
        /// Saves the application.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <returns></returns>
        public async Task <bool> SaveApplication(ModelApplication application)
        {
            using (var db = new MancobaLocalDataApi(_connectionFactory, _platformCapabilities))
            {
                var entity = application.ToEntity();
                await db.SaveApplication(entity);

                return(true);
            }
        }
Beispiel #7
0
        /// <summary>
        /// Gets the sent applications.
        /// </summary>
        /// <returns></returns>
        public async Task <List <ModelApplication> > GetSentApplications()
        {
            using (var db = new MancobaLocalDataApi(_connectionFactory, _platformCapabilities))
            {
                var response = await db.GetSentApplications();

                if (response == null || response.Count == 0)
                {
                    response = await TestData.GetSentApplications();
                }

                return(response.ToModelCollection());
            }
        }
Beispiel #8
0
        /// <summary>
        /// Gets the system user.
        /// </summary>
        /// <returns></returns>
        public async Task <ModelSystemUser> GetSystemUser()
        {
            using (var db = new MancobaLocalDataApi(_connectionFactory, _platformCapabilities))
            {
                if (_systemUser == null)
                {
                    var response = await db.GetAnySystemUser();

                    _systemUser = response.ToModel();
                }

                return(_systemUser);
            }
        }
Beispiel #9
0
        /// <summary>
        /// Gets the application.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns></returns>
        public async Task <ModelApplication> GetApplication(string id)
        {
            using (var db = new MancobaLocalDataApi(_connectionFactory, _platformCapabilities))
            {
                var response = await db.GetApplication(id);

                if (response == null)
                {
                    var tempTestList = await TestData.GetSentApplications().ConfigureAwait(false);

                    response = tempTestList.FirstOrDefault();
                }
                return(response.ToModel());
            }
        }
Beispiel #10
0
        /// <summary>
        /// Logins the specified email address.
        /// </summary>
        /// <param name="emailAddress">The email address.</param>
        /// <param name="password">The password.</param>
        /// <returns></returns>
        public async Task <ModelSystemUser> Login(string emailAddress, string password)
        {
            TestData.ConnectionFactory    = _connectionFactory;
            TestData.PlatformCapabilities = _platformCapabilities;

            using (var db = new MancobaLocalDataApi(_connectionFactory, _platformCapabilities))
            {
                var response = await db.Login(emailAddress, password);

                if (response == null)
                {
                    response = await TestData.GetSystemUser(emailAddress, password);
                }

                return(_systemUser = response.ToModel());
            }
        }