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); }
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() }); }
public void Remove(AllotmentEvent entity) => _editContext.AllotmentEvents.Remove(entity);
public void Add(AllotmentEvent allotmentEvent) => _editContext.AllotmentEvents.Add(allotmentEvent);