コード例 #1
0
        public async Task <ActionResult <contracts.Integration> > Create([FromBody] contracts.Integration integration)
        {
            var mapIntegration    = _mapper.Map <contracts.Integration, domain.Integration>(integration);
            var integrationResult = await _integrationService.CreateIntegration(mapIntegration);

            var createdIntegrationContracts = _mapper.Map <domain.Integration, contracts.Integration>(integrationResult);

            return(Ok(createdIntegrationContracts));
        }
コード例 #2
0
 public IActionResult Post([FromBody] EIntegration Integration)
 {
     try
     {
         service.CreateIntegration(Integration);
         return(StatusCode((int)HttpStatusCode.Created, Integration));
     }
     catch (IntegrationAlreadyExistsException nex)
     {
         return(Conflict(nex.Message));
     }
     catch
     {
         return(StatusCode((int)HttpStatusCode.InternalServerError));
     }
 }
コード例 #3
0
        public async Task <IActionResult> Create(IntegrationCreateModel model)
        {
            if (model.IsNotValid())
            {
                model.SetInputModelValues();
                return(View(model));
            }

            var request  = new IntegrationCreateRequest(CurrentUser.Id, model.OrganizationUid, model.Name, model.Description);
            var response = await _integrationService.CreateIntegration(request);

            if (response.Status.IsNotSuccess)
            {
                model.MapMessages(response);
                model.SetInputModelValues();
                return(View(model));
            }

            CurrentUser.IsActionSucceed = true;
            return(Redirect($"/Integration/Detail/{response.Item.Uid}"));
        }