コード例 #1
0
        /// <summary>
        /// Deletes the given model.
        /// </summary>
        /// <param name="model">The model</param>
        public async Task DeleteAsync(Alias model)
        {
            // Call hooks & delete
            App.Hooks.OnBeforeDelete(model);
            await _repo.Delete(model.Id).ConfigureAwait(false);

            App.Hooks.OnAfterDelete(model);

            // Remove from cache
            RemoveFromCache(model);
        }
コード例 #2
0
        public IActionResult DeleteAlias(int id)
        {
            if (!_aliasRepo.Get(id).Success)
            {
                return(NotFound($"Alias {id} not found"));
            }

            var result = _aliasRepo.Delete(id);

            if (result.Success)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest(result.Messages));
            }
        }
コード例 #3
0
        public IActionResult Delete(int id)
        {
            var getAliasResponse = aliasRepo.Get(id);

            if (!getAliasResponse.Success)
            {
                return(NotFound($"Alias {id} not found"));
            }

            var response = aliasRepo.Delete(id);

            if (response.Success)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest(response.Message));
            }
        }