public async Task <IActionResult> Add(TestTable model) { if (ModelState.IsValid) { _testService.AddAsync(model); } return(RedirectToAction("Index")); }
public async Task <IActionResult> PostTest([FromBody] TestPostDto testDto) { if (null == testDto) { return(InvalidRequestBodyJson(nameof(TestDto))); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var newTest = Mapper.Map <Test>(testDto); newTest.TenantId = _tenantIdProvider.GetTenantId(); await _testService.AddAsync(newTest); return(Created(nameof(GetTest), new CreatedWithGuidDto { Id = newTest.Id })); }