public async Task <ComplexStringDTO> AddComplexString(ComplexStringDTO entity) { var sqlComplexString = new Polyglot.DataAccess.Entities.ComplexString { TranslationKey = entity.Key, ProjectId = entity.ProjectId }; var savedEntity = await _unitOfWork.GetRepository <Polyglot.DataAccess.Entities.ComplexString>().CreateAsync(sqlComplexString); await _unitOfWork.SaveAsync(); entity.Id = savedEntity.Id; entity.CreatedOn = DateTime.Now; entity.CreatedBy = (await _currentUser.GetCurrentUserProfile()).Id; var mappedItem = _mapper.Map <ComplexString>(entity); mappedItem.Tags = entity.Tags.Select(x => x.Id).ToList(); var target = await _complexStringRepository.CreateAsync(mappedItem); if (target != null) { await _signalRWorkspaceService.ComplexStringAdded($"{Group.project}{target.ProjectId}", target.Id); return(_mapper.Map <ComplexStringDTO>(target)); } return(null); }
public async Task <ActionResult <StaffCreateModel> > PostAsync([FromBody] StaffCreateModel employee) { // var employeeNewID = employee with { Id = null }; // Mapping By Mapster var newEmployee = employee.Adapt <Staff>(); await _staffRepository.CreateAsync(newEmployee); return(CreatedAtAction(nameof(GetByIdAsync), new { id = newEmployee.Id }, newEmployee)); }
public async Task <User> AddUser(UserDto userDto) { var user = new User { UserId = userDto.UserId, Email = userDto.Email, UserName = userDto.Name, }; return(await _repository.CreateAsync(user)); }
public async Task <ActionResult <GameItemDto> > PostAsync(CreateGameItemDto dto) { var item = new GameItem { Name = dto.Name, Description = dto.Description, Price = dto.Price, CreatedDate = DateTimeOffset.UtcNow }; await _mongoRepository.CreateAsync(item); // Publish message to the RabbitMQ await _publishEndpoint.Publish(new GameCatalogItemUCreated(item.Id, item.Name, item.Description)); return(CreatedAtAction(nameof(GetByIdAsync), new { id = item.Id }, item)); }
public async Task CreateAsync(Order order) => await _repository.CreateAsync(order);
public async Task CreateAsync(RefreshToken token) => await _repository.CreateAsync(token);
public async Task AddAsync(Product product) => await _repository.CreateAsync(product);
public async Task CreateAsync(FrequentFlyer customer) => await _repository.CreateAsync(customer);
public async Task CreateAsync(Customer customer) => await _repository.CreateAsync(customer);
public async Task CreateAsync(User user) => await _repository.CreateAsync(user);
public async Task CreateAsync(Ngo ngo) => await _repository.CreateAsync(ngo);
public async Task CreateAsync(Cart cart) => await _repository.CreateAsync(cart);