using LifePayment.Application.Contracts; using LifePayment.Domain.Common; using LifePayment.Domain.Models; using LifePayment.Domain.Shared; using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Repositories; namespace LifePayment.Application { public class CommonService : ApplicationService, ICommonService { private readonly IRepository _onlineServiceRepository; public CommonService( IRepository onlineServiceRepository) { _onlineServiceRepository = onlineServiceRepository; } public async Task GetOnlineService() { var query = await _onlineServiceRepository.FirstOrDefaultAsync(); return query.Link; } public async Task UpdateOnlineService(OnlineServiceInput input) { var area = await _onlineServiceRepository.FirstOrDefaultAsync(); if (area != null) { area.Link = input.Link; } else { OnlineService onlineService = new OnlineService() { Id = Guid.NewGuid(), Link = input.Link }; await _onlineServiceRepository.InsertAsync(onlineService); } } } }