Esempio n. 1
0
        public IActionResult Domain(AddDomainRequest request)
        {
            ValidateEntity <AddDomainRequest>(request);

            Entities.Domain domain = new Entities.Domain()
            {
                Id             = Guid.NewGuid(),
                Name           = request.Name,
                ParentDomainId = String.IsNullOrWhiteSpace(request.Parent) ? Guid.Empty : Guid.Parse(request.Parent)
            };

            Business.Domain.Add(domain);

            return(GetOutput(new AddDomainResponse()
            {
                Domain = domain
            }, 201));
        }
Esempio n. 2
0
        public override async Task <AddDomainResponse> AddDomain(AddDomainRequest request, ServerCallContext context)
        {
            var payer = await dbContext.Users.FindIfNullThrowAsync(request.PayUserId);

            var system = await dbContext.Systems.FirstOrDefaultAsync();

            var domain = new DomainEntity(Guid.Parse(request.Id), payer, Resources.Zero, system);
            var userDomainAssignment = new UserDomainAssignment(Guid.Parse(request.PayUserAssignmentId), domain, payer);

            dbContext.Domains.Add(domain);
            dbContext.UserDomainAssignments.Add(userDomainAssignment);

            dbContext.BillingCycleEntries.Add(new BillingCycleEntry(domain.BillingCycleSubject));
            dbContext.UseCycleEntries.Add(new UseCycleEntry(domain.UseCycleSubject));
            dbContext.ManagementFeeEntries.Add(new ManagementFeeEntry(domain.Payer));

            await dbContext.SaveChangesAsync();

            return(new AddDomainResponse {
            });
        }
Esempio n. 3
0
 /// <summary>
 ///  新增网站
 /// </summary>
 /// <param name="request">请求参数信息</param>
 /// <returns>请求结果信息</returns>
 public async Task <AddDomainResponse> AddDomain(AddDomainRequest request)
 {
     return(await new AddDomainExecutor().Client(this).Execute <AddDomainResponse, AddDomainResult, AddDomainRequest>(request).ConfigureAwait(false));
 }
Esempio n. 4
0
 /// <summary>
 ///  新增网站
 /// </summary>
 /// <param name="request">请求参数信息</param>
 /// <returns>请求结果信息</returns>
 public AddDomainResponse AddDomain(AddDomainRequest request)
 {
     return(new AddDomainExecutor().Client(this).Execute <AddDomainResponse, AddDomainResult, AddDomainRequest>(request));
 }