示例#1
0
        public async Task When_CreatingModule_Expect_ModuleCreated(string name)
        {
            var moduleNew = new ModuleNewDto {
                Name = name
            };
            var id = await _modulesService.Create(moduleNew);

            var actualModuleCreated = await _context.Modules.FirstAsync(m => m.Id == id);

            Assert.Equal(name, actualModuleCreated.Name);
        }
示例#2
0
        public async Task <IActionResult> CreateModule([FromBody] ModuleNewDto moduleNew)
        {
            try
            {
                var id = await _modulesService.Create(moduleNew);

                return(Ok(id));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }