Exemplo n.º 1
0
        public ActionResult <CommandReadModel> AddCommand(CommandCreateModel command)
        {
            //Basic Validatation happens through Annotations on Create Command Model

            if (!_service.Add(command, out var createdCommand))
            {
                //TODO: Wouldnt do this for real in production environment, but, until we get round to it
                return(new NoContentResult());
            }

            //TODO: Don't leak the database Id, rather use the restful entity id
            return(CreatedAtRoute(nameof(LookupCommand), new { Id = createdCommand.Id }, createdCommand));
        }
Exemplo n.º 2
0
 public ActionResult Add([FromBody] Article article)
 {
     _commandService.Add(article);
     return(Ok());
 }