Ejemplo n.º 1
0
        public async Task PostArticleAsync([FromBody] RegisterArticleModel model)
        {
            var command = _mapper.Map <RegisterArticle>(model);

            //ToDo:3  command.InitiatorId = User.Identity.Id;
            command.InitiatorId = Guid.NewGuid();
            await _commandInvoker.Execute(command);
        }
Ejemplo n.º 2
0
 public async Task <IHttpActionResult> Create(RegisterArticleModel articleModel)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     try
     {
         var article = new RegisterArticleDTO
         {
             Text             = articleModel.Text,
             Header           = articleModel.Header,
             ImageUrl         = articleModel.ImageUrl,
             ShortDescription = articleModel.ShortDescription,
             UserId           = CurrentUserId
         };
         _articleService.Create(article);
         return(Ok());
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }