public async Task <IActionResult> Create(ActorCreateViewModel viewModel) { if (!TryValidateModel(viewModel)) { return(View(viewModel)); } var actor = Mapper.Map <Actor>(viewModel); await _actorService.AddAsync(actor); return(RedirectToAction(nameof(Index))); }
private CoinDto SendCoin(CoinDto coin) { spinner.Text = "Sending printed coin ;)"; var coinResult = actorService.AddAsync(coin.FormatCoinToBase64(), RestApiMethod.PostCoin).GetAwaiter().GetResult(); if (coinResult == null) { for (int i = 0; i < 10; i++) { spinner.Text = $"Retrying sending coin {i} of 10"; coinResult = actorService.AddAsync(coin.FormatCoinToBase64(), RestApiMethod.PostCoin).GetAwaiter().GetResult(); Task.Delay(100).Wait(); if (coinResult != null) { break; } } } return(coinResult); }
public async Task <IActionResult> Post([FromBody] AddActorDto addActor) { var id = await _actorService.AddAsync(addActor); return(CreatedAtAction(nameof(Get), new { Id = id })); }
public async Task <IActionResult> Save(ActorDto actorDto) { var newActor = await _actorService.AddAsync(_mapper.Map <Actor>(actorDto)); return(Created(string.Empty, _mapper.Map <ActorDto>(newActor))); }