public async Task <IActionResult> Create(
            [FromBody] CreateDocumentTypeCommand createDocumentTypeCommand)
        {
            var response = await _mediator.Send(createDocumentTypeCommand);

            return(Ok(response));
        }
        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));
        }
Beispiel #3
0
 public static DocumentType ToDocumentType(this CreateDocumentTypeCommand command)
 {
     return(command.MapTo <CreateDocumentTypeCommand, DocumentType>());
 }
 public static DocumentType CreateDocumentTypeFrom(CreateDocumentTypeCommand cmd)
 {
     return(new DocumentType {
         Name = cmd.Name
     });
 }
Beispiel #5
0
 public IActionResult Post([FromBody] CreateDocumentTypeCommand cmd)
 => createCommand.Execute(cmd).Match(
     x => x.Match <IActionResult>(
         Ok,
         BadRequest),
     ex => StatusCode(500, ex));