コード例 #1
0
        public async Task <IActionResult> PutAsync(PaymentSourceInputModel model)
        {
            if (ModelState.IsValid)
            {
                var result = await commands.SendAsync(model.ToChangeNameCommand());

                if (result.IsSuccess)
                {
                    return(NoContent());
                }

                return(StatusCode(500, result.Error));
            }

            return(BadRequest(ModelState));
        }
コード例 #2
0
        public async Task <IActionResult> PostAsync(PaymentSourceInputModel model)
        {
            if (ModelState.IsValid)
            {
                var result = await commands.SendAsync(model.ToAddCommand());

                if (result.IsSuccess)
                {
                    return(Created(Url.Action("Get", new { id = model.Id }), null));
                }

                return(StatusCode(500, result.Error));
            }

            return(BadRequest(ModelState));
        }