public async Task <Customer> GetCustomer(int id)
        {
            var http = new TcHttp($"{UriCustomers}/{id}");

            var result = await http.GetJsonClass <Customer>();

            return(result);
        }
        public async Task <Project> GetProject(int id)
        {
            var http = new TcHttp($"{UriProjects}/{id}");

            var result = await http.GetJsonClass <Project>();

            return(result);
        }
        public async Task <List <FileLink> > GetManuals()
        {
            var http = new TcHttp(UriFileLink);

            var result = await http.GetJsonList <FileLink>();

            var manualLinks = result.OrderBy(c => c.Category.Name).ToList();

            return(manualLinks);
        }
        public async Task <List <Category> > GetCategories()
        {
            var h = new TcHttp($"{UriCategories}");;

            var result = await h.GetJsonList <Category>();

            var categories = result.OrderBy(c => c.Name).ToList();

            return(categories);
        }
예제 #5
0
        public async Task <List <EmailSent> > GetEmails()
        {
            var h = new TcHttp($"{UriEmails}");;

            var result = await h.GetJsonList <EmailSent>();

            var emails = result.OrderBy(c => c.DateTime).ToList();

            return(emails);
        }
        public async Task <List <Project> > GetProjects()
        {
            var http = new TcHttp(UriProjects);

            var result = await http.GetJsonList <Project>();

            var manualLinks = result.OrderBy(c => c.Customer.Number).ToList();

            return(manualLinks);
        }
        public async Task <List <Customer> > GetCustomers()
        {
            var http = new TcHttp(UriCustomers);

            var result = await http.GetJsonList <Customer>();

            var customers = result.OrderBy(c => c.Number).ToList();

            return(customers);
        }
        public async Task <bool> DeleteManual(int Id)
        {
            var http     = new TcHttp($"{UriFileLink}/{Id}");
            var response = await http.GetHttpClient().DeleteAsync($"{UriFileLink}/{Id}");

            if (response.IsSuccessStatusCode)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public async Task <bool> PostDocument(FileLink file)
        {
            var http    = new TcHttp(UriFileLink);
            var content = http.GetJsonHttpContent(file);

            var response = await http.GetHttpClient().PostAsync(UriFileLink, content);

            if (response.IsSuccessStatusCode)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public async Task <List <Category> > PostCategory(Category category)
        {
            var http    = new TcHttp(UriCategories);
            var content = http.GetJsonHttpContent(category);

            var response = await http.GetHttpClient().PostAsync(UriCategories, content);

            if (response.IsSuccessStatusCode)
            {
                return(await GetCategories());;
            }
            else
            {
                return(null);
            }
        }
        public async Task <bool> UpdateProject(int Id, Project project)
        {
            var http    = new TcHttp($"{UriProjects}/{Id}");
            var content = http.GetJsonHttpContent(project);

            var response = await http.GetHttpClient().PutAsync($"{UriProjects}/{Id}", content);

            if (response.IsSuccessStatusCode)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public async Task <bool> SendEmail(EmailContent emailContent)
        {
            var http    = new TcHttp($"{UriEmail}");
            var content = http.GetJsonHttpContent(emailContent);

            var response = await http.GetHttpClient().PostAsync(UriEmail, content);

            if (response.IsSuccessStatusCode)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public async Task <bool> UpdateCustomer(int Id, Customer customer)
        {
            var http    = new TcHttp($"{UriCustomers}/{Id}");
            var content = http.GetJsonHttpContent(customer);

            var response = await http.GetHttpClient().PutAsync($"{UriCustomers}/{Id}", content);

            if (response.IsSuccessStatusCode)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public async Task <bool> SaveProjectItem(ProjectItem projectItem)
        {
            var http    = new TcHttp($"{UriProjectItems}");
            var content = http.GetJsonHttpContent(projectItem);

            var response = await http.GetHttpClient().PostAsync(UriProjectItems, content);

            if (response.IsSuccessStatusCode)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public async Task <bool> UpdateDocument(int id, FileLink file)
        {
            if (id != file.FileLinkId)
            {
                return(false);
            }

            var http    = new TcHttp($"{UriFileLink}/{id}");
            var content = http.GetJsonHttpContent(file);

            var response = await http.GetHttpClient().PutAsync($"{UriFileLink}/{id}", content);

            if (response.IsSuccessStatusCode)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }