コード例 #1
0
        public ActionResult DeleteItem(int id)
        {
            var modelFromRepo = _repository.GetItemById(id);

            if (modelFromRepo == null)
            {
                return(NotFound());
            }
            _repository.DeleteItem(modelFromRepo);
            _repository.SaveChanges();
            _logger.LogInformation("Item with ID: {id} DELETED by {HttpUser} ", id, HttpContext.User.Identity.Name);
            return(NoContent());
        }