コード例 #1
0
 public IActionResult Post([FromBody] FlowModel flow)
 {
     try
     {
         _flowService.Add(flow.ToDomainModel());
     }
     catch (System.Exception ex)
     {
         ModelState.AddModelError("AddFlow", ex.GetBaseException().Message);
         return(BadRequest(ModelState));
     }
     return(CreatedAtAction("Get", new { Id = flow.Id }, flow));
 }
コード例 #2
0
        public IActionResult Post([FromBody] FlowModel flow)
        {
            var addedFlow = _service.Add(new Business.Service.DTOs.Flow.FlowDto
            {
                Title = flow.Title
            });

            if (addedFlow == null)
            {
                return(UnprocessableEntity());
            }

            return(Created(new Uri($"{Request.Scheme}://{Request.Host}{Request.Path}/{addedFlow.Id}"), addedFlow));
        }