コード例 #1
0
        public async Task <IActionResult> Create(
            [FromBody] CreateDocumentTypeCommand createDocumentTypeCommand)
        {
            var response = await _mediator.Send(createDocumentTypeCommand);

            return(Ok(response));
        }
コード例 #2
0
        public async Task <int> Create([FromBody] CreateDocumentTypeCommand createDocumentTypeCommand)
        {
            createDocumentTypeCommand.CreatedBy = User.Identity.GetUserName();
            createDocumentTypeCommand.CreatedOn = DateTime.Now;
            createDocumentTypeCommand.Deleted   = false;

            return(await Mediator.Send(createDocumentTypeCommand));
        }
コード例 #3
0
 public static DocumentType ToDocumentType(this CreateDocumentTypeCommand command)
 {
     return(command.MapTo <CreateDocumentTypeCommand, DocumentType>());
 }
コード例 #4
0
 public static DocumentType CreateDocumentTypeFrom(CreateDocumentTypeCommand cmd)
 {
     return(new DocumentType {
         Name = cmd.Name
     });
 }
コード例 #5
0
 public IActionResult Post([FromBody] CreateDocumentTypeCommand cmd)
 => createCommand.Execute(cmd).Match(
     x => x.Match <IActionResult>(
         Ok,
         BadRequest),
     ex => StatusCode(500, ex));