コード例 #1
0
        public async Task <TestPlanModel> CreateTestPlanAsync(AddTestPlanModel testPlan)
        {
            var testPlanEntity = Mapper.Map <TestPlan>(testPlan);
            var entity         = await _context.TestPlans.AddAsync(new TestPlan(testPlan.Title, testPlan.Description));

            await _context.SaveChangesAsync();

            var testPlanModel = Mapper.Map <TestPlanModel>(entity);

            return(testPlanModel);
        }
コード例 #2
0
        public async Task <IActionResult> CreateTestPlanAsync([FromBody] AddTestPlanModel testPlan)
        {
            if (testPlan == null)
            {
                return(BadRequest());
            }
            ;
            var testPlanModel = await _service.CreateTestPlanAsync(testPlan);

            return(CreatedAtRoute("GetTestPlan", new { id = testPlanModel.TestPlanId },
                                  testPlanModel));
        }