using Oqtane.Models; using System.Threading.Tasks; using System.Net.Http; using System.Linq; using System.Collections.Generic; namespace Oqtane.Services { public class JobLogService : ServiceBase, IJobLogService { public JobLogService(HttpClient http) :base(http) { } private string Apiurl => CreateApiUrl("JobLog"); public async Task> GetJobLogsAsync() { List joblogs = await GetJsonAsync>(Apiurl); return joblogs.OrderBy(item => item.StartDate).ToList(); } public async Task GetJobLogAsync(int jobLogId) { return await GetJsonAsync($"{Apiurl}/{jobLogId}"); } public async Task AddJobLogAsync(JobLog joblog) { return await PostJsonAsync(Apiurl, joblog); } public async Task UpdateJobLogAsync(JobLog joblog) { return await PutJsonAsync($"{Apiurl}/{joblog.JobLogId}", joblog); } public async Task DeleteJobLogAsync(int jobLogId) { await DeleteAsync($"{Apiurl}/{jobLogId}"); } } }