public async Task <IActionResult> Create(PostsCreateViewModel model)
        {
            if (ModelState.IsValid)
            {
                var input = ObjectMapper.Map <CreatePostInput>(model);
                await _postApplicationService.Create(input);

                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
Exemple #2
0
 public Task HandleAsync(IUpdateContext context, UpdateDelegate next, CancellationToken cancellationToken)
 {
     return(_postApplicationService.Create(new CreatePostInput {
         Body = context.Update.Message?.Text ?? context.Update.ChannelPost?.Text
     }));
 }