public async Task Execute(DeleteSetting command)
        {
            var setting = await writeContext.OutbreakSettings
                          .FindAsync((short)command.Id);

            if (setting == null)
            {
                throw new EntityNotFoundException(typeof(OutbreakSettings), command.Id);
            }

            writeContext.OutbreakSettings.Remove(setting);

            await writeContext.SaveChangesAsync();
        }
Exemple #2
0
        public async Task <IActionResult> DeleteSettingAsync([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var command = new DeleteSetting
            {
                Id = id
            };

            await service.Execute(command);

            return(Ok());
        }