コード例 #1
0
        public void DeleteImage(int id, int autoId, int userId)
        {
            var auto = _autoRepo.GetById(autoId);

            if (auto.UserId != userId)
            {
                throw new Exception("You don't own this car");
            }

            foreach (var image in auto.Images.Where(image => image.Id == id))
            {
                _autoRepo.DeleteImage(id);
            }
        }