Пример #1
0
        public async Task <MsgOutput> DeleteAsync([FromRoute] int id, [FromRoute] byte[] timestamp)
        {
            var key = new KeyStamp <int>(id, timestamp);
            await _userinfoService.DeleteAsync(new[] { key });

            return(MsgOutputOption.OkMsg);
        }
Пример #2
0
        public async Task <IActionResult> DeleteItemAsync(string id, CancellationToken cancellationToken)
        {
            // validate if data exists
            var itemToDelete = await _userInfoService.GetByIdAsync(id, cancellationToken);

            if (itemToDelete == null)
            {
                throw new EntityNotFoundException(nameof(UserInfo), id);
            }

            // delete data
            var result = await _userInfoService.DeleteAsync(itemToDelete, cancellationToken);

            if (!result)
            {
                AssignToModelState(_userInfoService.Errors);
                return(ValidationProblem());
            }

            return(NoContent());
        }