Ejemplo n.º 1
0
        public async Task <long> CreateAsync(
            string name,
            string tokenContractAddress,
            int tokenDecimals,
            string tokenTicker,
            long projectId,
            DateTimeOffset?finishDate)
        {
            var entity = new AllotmentEvent
            {
                Name                 = name,
                ProjectId            = projectId,
                TokenContractAddress = tokenContractAddress,
                TokenTicker          = tokenTicker,
                TokenDecimals        = tokenDecimals,
                Status               = AllotmentEventStatus.Created,
                FinishDate           = finishDate,
                CreatedDate          = _clock.UtcNow
            };

            _allotmentEventRepository.Add(entity);

            await _allotmentEventRepository.SaveChangesAsync();

            return(entity.Id);
        }
Ejemplo n.º 2
0
 public static AllotmentEventResponse Create(AllotmentEvent allotmentEvent, DateTimeOffset now)
 {
     return(new AllotmentEventResponse
     {
         Id = allotmentEvent.Id,
         Name = allotmentEvent.Name,
         ProjectId = allotmentEvent.ProjectId,
         Status = allotmentEvent.GetActualStatus(now),
         TokenContractAddress = allotmentEvent.TokenContractAddress,
         EventContractAddress = allotmentEvent.EventContractAddress,
         TotalTokens = string.IsNullOrWhiteSpace(allotmentEvent.TotalTokensToDistribute) ? "0" : allotmentEvent.TotalTokensToDistribute,
         StartDate = allotmentEvent.StartDate,
         FinishDate = allotmentEvent.FinishDate,
         TokenDecimals = allotmentEvent.TokenDecimals,
         TokenTicker = allotmentEvent.TokenTicker,
         Participants = allotmentEvent.Participants.Select(x => new AllotmentEventParticipantResponse(x.Bid, x.Share, x.UserId, x.IsCollected)).ToArray()
     });
 }
Ejemplo n.º 3
0
 public void Remove(AllotmentEvent entity)
 => _editContext.AllotmentEvents.Remove(entity);
Ejemplo n.º 4
0
 public void Add(AllotmentEvent allotmentEvent)
 => _editContext.AllotmentEvents.Add(allotmentEvent);